Eagle Legacy Modernization, LLC

SQL Grammar

Main program: SQL_Program

 Count  Terminals:
332 SQL_Comment: Comment
3 SQL_Declare_Definition: An identifier
192 SQL_Field_Definition: An identifier
  SQL_HexString: A string enclosed in quotes
50 SQL_Identifier: An identifier
50,564 SQL_Identifier_Reference: An identifier
10 SQL_Index_Definition: An identifier
21 SQL_Key_Definition: An identifier
15,433 SQL_Literal: A string enclosed in quotes
27,516 SQL_Number: A number
16 SQL_Role_Definition: An identifier
67 SQL_Synonym_Definition: An identifier
27 SQL_Table_Definition: An identifier
8 SQL_View_Definition: An identifier
 Count  Statistics(*) Tokens:
14 all all all all all 1.29 all 86% SQL_Constraint: "CONSTRAINT" SQL_Key_Definition ("FOREIGN"|"PRIMARY") "KEY" '(' SQL_Identifier_Reference* ')' [SQL_ConstraintReference]
12 all all all 1.00 all |   SQL_ConstraintReference: "REFERENCES" SQL_Identifier_Reference '(' SQL_Identifier_Reference* ')'
52,661 (52% | 29% | none | 0% | 0% | none | 9% | 0% | none | 0% | 9% | 0% | none) SQL_Expression: (SQL_Number | SQL_Literal | SQL_HexString | SQL_Builtin | SQL_FunctionExpression | SQL_DollarVariable | SQL_VariableExpression | SQL_Star | SQL_MultiplicativeExpression | SQL_AdditiveExpression | SQL_RelationalExpression | SQL_AndExpression | SQL_OrExpression)
4 all all all |   SQL_AdditiveExpression: SQL_Expression ("+"|"-") SQL_Expression
8 all all all |   SQL_AndExpression: SQL_Expression "AND" SQL_Expression
8 all |   SQL_Builtin: ("CURRENT_TIMESTAMP"|"SYSTIMESTAMP")
    |   SQL_DollarVariable: '$' SQL_Number
22 all |   SQL_FunctionExpression: SQL_Function
    |   SQL_MultiplicativeExpression: SQL_Expression ("*"|"/"|"%") SQL_Expression
    |   SQL_OrExpression: SQL_Expression "OR" SQL_Expression
4,873 all all all |   SQL_RelationalExpression: SQL_Expression SQL_RelationalOperator SQL_Expression
4,873 (0% | 100%) |   |   SQL_RelationalOperator: ("LIKE" | ("="|"!="|"<"|">"|"<="|">="))
1 all |   SQL_Star: '*'
4,967 all |   SQL_VariableExpression: SQL_Variable
25 all all all SQL_Filename: SQL_Identifier '.' SQL_Identifier
22 all all 2.29(77%) all SQL_Function: SQL_Variable '(' [SQL_FunctionParam]* ')'
28 (4% | 25% | 71%) |   SQL_FunctionParam: (SQL_FunctionColonParam | SQL_FunctionNamedParam | SQL_Expression)
1 all all |   |   SQL_FunctionColonParam: ':' SQL_Expression
7 all all all |   |   SQL_FunctionNamedParam: SQL_Identifier_Reference "=>" SQL_Expression
27 292.63 SQL_Program: SQL_StatementOrComment*
7,909 (96% | 4%) |   SQL_StatementOrComment: (SQL_Statement | SQL_Comment)
7,577 (0% | 0% | 0% | 0% | 2% | 0% | 0% | 2% | 0% | 1% | 0% | 30% | none | 0% | 0% | 64% | 0% | 0%) SQL_Statement: (SQL_AlterStatement | SQL_AtAtStatement | SQL_BeginStatement | SQL_ColumnStatement | SQL_CreateStatement | SQL_DeclareStatement | SQL_DeleteStatement | SQL_DropStatement | SQL_ForStatement | SQL_GrantStatement | SQL_LoadStatement | SQL_InsertStatement | SQL_PragmaStatement | SQL_SelectStatement | SQL_SlashStatement | SQL_UpdateStatement | SQL_VariableStatement | SQL_ExpressionStatement)
195 (none | 4% | none | 10% | none | 2% | 25% | 11% | 1% | none | 1% | 2% | 45%) SQL_Type: (SQL_TypeBigInt | SQL_TypeBlob | SQL_TypeBoolean | SQL_TypeDate | SQL_TypeDouble | SQL_TypeEnum | SQL_TypeInt | SQL_TypeRaw | SQL_TypeSet | SQL_TypeSize | SQL_TypeText | SQL_TypeTimeStamp | SQL_TypeVarChar)
    |   SQL_TypeBigInt: "BIGINT" SQL_TypeSize
8 all |   SQL_TypeBlob: ("BLOB"|"NCLOB")
    |   SQL_TypeBoolean: ("BOOLEAN")
20 all |   SQL_TypeDate: "DATE"
    |   SQL_TypeDouble: ("DOUBLE")
3 all all 3.67 all |   SQL_TypeEnum: "ENUM" '(' SQL_Expression* ')'
49 all 65% |   SQL_TypeInt: ("INT"|"INTEGER"|"NUMBER") [SQL_TypeSize]
21 all all |   SQL_TypeRaw: "RAW" SQL_TypeSize
1 all all 3.00 all |   SQL_TypeSet: "SET" '(' SQL_Expression* ')'
141 all all 1% 1% all |   SQL_TypeSize: '(' SQL_Number [','] [SQL_Number] ')'
2 all |   SQL_TypeText: "TEXT"
3 all |   SQL_TypeTimeStamp: "TIMESTAMP"
88 all all |   SQL_TypeVarChar: ("CHAR"|"LONGVARCHAR"|"NVARCHAR2"|"VARCHAR"|"VARCHAR2") [SQL_TypeSize]
4,990 1.01 SQL_Variable: SQL_Identifier_Reference*
9 all all all SQL_AlterStatement: "ALTER" SQL_AlterWhat ';'
9 (all) |   SQL_AlterWhat: (SQL_AlterTable)
9 all all all all 22% |   |   SQL_AlterTable: "TABLE" SQL_Identifier_Reference ("ADD") SQL_Constraint [SQL_OnDelete]
2 all all all |   |   |   SQL_OnDelete: "ON" "DELETE" "CASCADE"
25 all all 12% SQL_AtAtStatement: "@@" SQL_Filename [';']
4 all all all SQL_BeginStatement: "BEGIN" SQL_BeginWhat ';'
4 (all | none) |   SQL_BeginWhat: (SQL_BeginEnd | SQL_BeginTransaction)
4 1.50 25% all |   |   SQL_BeginEnd: SQL_StatementOrComment* [SQL_CommitStatement] "END"
    |   |   SQL_BeginTransaction: "TRANSACTION" ';' SQL_StatementOrComment* "COMMIT"
8 all all all all all SQL_ColumnStatement: ("COLUMN"|"COL") SQL_Identifier_Reference "NEW_VALUE" SQL_Expression ';'
1 all all SQL_CommitStatement: "COMMIT" ';'
126 (8% | 13% | 53% | 20% | 6%) SQL_CreateStatement: (SQL_CreateIndexStatement | SQL_CreateRoleStatement | SQL_CreateSynonymStatement | SQL_CreateTableStatement | SQL_CreateViewStatement)
10 all all all all all all all 2.00 all all |   SQL_CreateIndexStatement: "CREATE" ["UNIQUE"] "INDEX" SQL_Index_Definition "ON" SQL_Identifier_Reference '(' SQL_Identifier_Reference* ')' ';'
16 all all all all |   SQL_CreateRoleStatement: "CREATE" "ROLE" SQL_Role_Definition ';'
67 all all all all all all all |   SQL_CreateSynonymStatement: "CREATE" "PUBLIC" "SYNONYM" SQL_Synonym_Definition "FOR" [SQL_CreateSynonymForWhom] ';'
67 all all all all |   |   SQL_CreateSynonymForWhom: '&' SQL_Identifier_Reference ".." SQL_Identifier_Reference
25 all all all all 14.36 1.23(52%) all 3.90(40%) all |   SQL_CreateTableStatement: "CREATE" "TABLE" SQL_Table_Definition '(' SQL_CreateField* [SQL_CreateFieldKey]* ')' [SQL_CreateOption]* ';'
192 all all 1.66(84%) |   |   SQL_CreateField: SQL_Field_Definition SQL_Type [SQL_FieldOption]*
268 (3% | 32% | 4% | 59% | 1% | 1%) |   |   |   SQL_FieldOption: (SQL_FieldComment | SQL_FieldDefault | SQL_FieldKey | SQL_FieldNotNull | SQL_FieldOnUpdate | "UNIQUE")
9 all all |   |   |   |   SQL_FieldComment: "COMMENT" SQL_Literal
86 all all |   |   |   |   SQL_FieldDefault: "DEFAULT" SQL_Expression
11 all all |   |   |   |   SQL_FieldKey: "PRIMARY" "KEY"
158 all all |   |   |   |   SQL_FieldNotNull: [("NON"|"NOT")] "NULL"
2 all all all |   |   |   |   SQL_FieldOnUpdate: "ON" "UPDATE" SQL_Expression
16 (31% | 38% | 25% | 6%) |   |   SQL_CreateFieldKey: (SQL_CreateFieldConstraint | SQL_CreateFieldPlainKey | SQL_CreateFieldPrimaryKey | SQL_CreateFieldUniqueKey)
5 all all |   |   |   SQL_CreateFieldConstraint: ',' SQL_Constraint
6 all all all all 1.67 all |   |   |   SQL_CreateFieldPlainKey: ',' "KEY" SQL_Key_Definition '(' SQL_Identifier_Reference* ')'
4 all all all all 1.50 all |   |   |   SQL_CreateFieldPrimaryKey: ',' "PRIMARY" "KEY" '(' SQL_Identifier_Reference* ')'
1 all all all all 1.00 all |   |   |   SQL_CreateFieldUniqueKey: ',' "UNIQUE" [SQL_CreateFieldUniqueKeyName] '(' SQL_Identifier_Reference* ')'
1 all all |   |   |   |   SQL_CreateFieldUniqueKeyName: "KEY" SQL_Key_Definition
39 (26% | 23% | 26% | 26%) |   |   SQL_CreateOption: (SQL_CreateCharset | SQL_CreateComment | SQL_CreateEngine | "DEFAULT")
10 all all all |   |   |   SQL_CreateCharset: "CHARSET" '=' ("latin1"|"utf8")
9 all all all |   |   |   SQL_CreateComment: "COMMENT" '=' SQL_Literal
10 all all all |   |   |   SQL_CreateEngine: "ENGINE" '=' "MyISAM"
8 all all all all all all all |   SQL_CreateViewStatement: "CREATE" ["OR"] ["REPLACE"] "VIEW" SQL_View_Definition "AS" SQL_SelectStatement
1 all 2.00 SQL_DeclareStatement: "DECLARE" SQL_Declaration*
2 all all all all all |   SQL_Declaration: SQL_Declare_Definition SQL_Type ":=" SQL_Expression ';'
7 all all all all all all SQL_DeleteStatement: "DELETE" "FROM" SQL_Identifier_Reference "WHERE" SQL_Expression ';'
176 all all all SQL_DropStatement: "DROP" SQL_DropWhat ';'
176 (31% | 1% | 8% | 9% | 38% | 9% | 5%) |   SQL_DropWhat: (SQL_DropFunction | SQL_DropPackage | SQL_DropProcedure | SQL_DropRole | SQL_DropSynonym | SQL_DropTable | SQL_DropView)
54 all all |   |   SQL_DropFunction: "FUNCTION" SQL_Identifier_Reference
2 all all |   |   SQL_DropPackage: "PACKAGE" SQL_Identifier_Reference
14 all all |   |   SQL_DropProcedure: "PROCEDURE" SQL_Identifier_Reference
16 all all |   |   SQL_DropRole: "ROLE" SQL_Identifier_Reference
67 all all all |   |   SQL_DropSynonym: "PUBLIC" "SYNONYM" SQL_Identifier_Reference
15 all all |   |   SQL_DropTable: "TABLE" SQL_Identifier_Reference
8 all all |   |   SQL_DropView: "VIEW" SQL_Identifier_Reference
4 all all SQL_ExpressionStatement: SQL_Expression ';'
1 all all all all all all all 2.00 all all all SQL_ForStatement: "FOR" SQL_Declare_Definition "IN" SQL_Expression ".." SQL_Expression "LOOP" SQL_StatementOrComment* "END" "LOOP" ';'
90 all all all all all SQL_GrantStatement: "GRANT" SQL_GrantPermission "TO" SQL_Identifier_Reference ';'
90 (91% | 9%) |   SQL_GrantPermission: (SQL_GrantPermissionOn | SQL_Identifier_Reference)
82 all all all |   |   SQL_GrantPermissionOn: ("EXECUTE"|"SELECT") "ON" SQL_Identifier_Reference
2,254 all all all all all SQL_InsertStatement: "INSERT" "INTO" SQL_Identifier_Reference SQL_InsertClause ';'
2,254 (100% | 0%) |   SQL_InsertClause: (SQL_InsertSet | SQL_InsertValues)
2,252 all 15.33 |   |   SQL_InsertSet: "SET" SQL_InsertAssignment*
18,390 all all all |   |   |   SQL_InsertAssignment: SQL_Identifier_Reference '=' SQL_Expression
2 none all all 3.00 all |   |   SQL_InsertValues: [SQL_InsertNames] "VALUES" '(' SQL_Expression* ')'
    |   |   |   SQL_InsertNames: '(' SQL_Identifier_Reference* ')'
2 all all all all all all all all all all all all all all all all all all all all all all SQL_LoadStatement: "LOAD" "DATA" "LOCAL" "INFILE" SQL_Literal "INTO" "TABLE" SQL_Identifier_Reference "FIELDS" "TERMINATED" "BY" SQL_Literal "ENCLOSED" "BY" SQL_Literal "ESCAPED" "BY" SQL_Literal "LINES" "TERMINATED" "BY" SQL_Literal
    SQL_PragmaStatement: "PRAGMA" SQL_PragmaClause* ';'
    |   SQL_PragmaClause: (SQL_Pragma_ForeignKeys)
    |   |   SQL_Pragma_ForeignKeys: "FOREIGN_KEYS" '=' "OFF"
18 all 7.22 11% all 17% 44% all SQL_SelectStatement: "SELECT" SQL_SelectWhat* [SQL_SelectInto] SQL_SelectFrom [SQL_SelectWhere] [SQL_SelectReadOnly] ';'
18 all all 6% 1.00(6%) |   SQL_SelectFrom: "FROM" SQL_Identifier_Reference [SQL_Table_Definition] [SQL_SelectFromMore]*
1 all all all |   |   SQL_SelectFromMore: ',' SQL_Identifier_Reference [SQL_Table_Definition]
2 all all |   SQL_SelectInto: "INTO" SQL_Identifier_Reference
8 all all all |   SQL_SelectReadOnly: "WITH" "READ" "ONLY"
74 (4% | 96%) |   SQL_SelectWhat: (SQL_SelectExpression | SQL_Expression)
3 all all |   |   SQL_SelectExpression: SQL_Expression SQL_Identifier_Reference
3 all all |   SQL_SelectWhere: "WHERE" SQL_Expression
4 all SQL_SlashStatement: '/'
4,855 all all all 7.00 all all all SQL_UpdateStatement: "UPDATE" SQL_Identifier_Reference "SET" SQL_UpdateAssignment* "WHERE" SQL_Expression ';'
19,417 all all all |   SQL_UpdateAssignment: SQL_Identifier_Reference '=' SQL_Expression
1 all all all all SQL_VariableStatement: "VARIABLE" SQL_Variable SQL_Type ';'

Terminals = 14 (instances=94,239)
Tokens = 111 (instances=140,144)

(*) Statistics are shown in the same order as the Tokens.
Percentages are rounded; 'all' and 'none' mean 100% and 0% before rounding.
For lists, it shows the average number of occurrences, excluding empty lists.