-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQL_Query_Subset.ebnf
93 lines (72 loc) · 1.75 KB
/
SQL_Query_Subset.ebnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
SELECT <select_list>
FROM <table_reference_list>
[ <where_clause> ]
[ <group_by_clause> ]
[ <having_clause> ]
[ <order_by_clause> ]
<select_list> ::=
<column_specifier> [ { , <column_specifier> } ... ]
| [ <aggregate_function>(<column_specifier>) ]
<column_specifier> ::=
[table_alias.] <column_specifier>
<aggregate_function> ::=
AVG
| MAX
| MIN
| COUNT
| SUM
<table_reference_list> ::=
[ schema_name. ] table_name [ AS table_alias ]
| <joined_table>
<joined_table> ::=
table_name [ <join_type> ] JOIN table_name <join_specification>
<join_type> ::=
INNER
| LEFT [OUTER]
| RIGHT [OUTER]
| FULL [OUTER]
<join_specification> ::=
ON <predicate_clause>
<predicate_clause> ::=
<predicate>
[ <concatenation> <predicate> ]
<concatenation> ::=
AND
| OR
<predicate_clause> ::=
<comparison_predicate>
| <between_predicate>
| <like_predicate>
| <null_predicate>
| <boolean_predicate>
<comparison_predicate> ::=
<column_specifier> <comp_op> column_value
<comp_op> ::=
=
| <>
| <
| >
| <=
| >=
<between_predicate> ::=
<column_specifier> [ NOT ] BETWEEN column_value AND column_value
<like_predicate> ::=
<column_specifier> [ NOT ] LIKE [ % ] string [ % ]
<null_predicate> ::=
<column_specifier> IS [ NOT ] NULL
<boolean_predicate> ::=
<column_specifier> IS [ NOT ] <truth_value>
<truth_value> ::=
TRUE
| FALSE
<where_clause> ::=
WHERE <predicate_clause>
<group_by_clause> ::=
GROUP BY <column_specifier> [ { , <column_specifier> } ... ]
<having_clause> ::=
HAVING <predicate_clause>
<order_by_clause ::=
ORDER BY <column_specifier> <sort_direction>
<sort_direction> ::=
ASC
| DESC