2
SELECT select_option grandparent_select_items
5
grandparent_group_having_order_limit;
7
grandparent_select_items:
8
grandparent_select_item;
10
grandparent_select_item:
11
GRANDPARENT1 . field_name AS G1;
14
table_name AS GRANDPARENT1 |
15
table_name AS GRANDPARENT1 LEFT JOIN table_name AS GRANDPARENT2 USING ( field_name ) |
16
table_name AS GRANDPARENT1 LEFT JOIN table_name AS GRANDPARENT2 ON ( grandparent_join_condition );
18
grandparent_join_condition:
19
GRANDPARENT2 . int_field_name arithmetic_operator GRANDPARENT1 . int_field_name |
20
GRANDPARENT2 . date_field_name arithmetic_operator GRANDPARENT1 . date_field_name |
21
GRANDPARENT2 . char_field_name arithmetic_operator GRANDPARENT1 . char_field_name ;
24
WHERE grandparent_subquery_expr AND grandparent_condition ;
26
grandparent_subquery_expr:
27
GRANDPARENT1 . int_field_name IN ( SELECT select_option PARENT1 . int_field_name AS P1 parent_select_body ) |
28
GRANDPARENT1 . char_field_name IN ( SELECT select_option PARENT1 . char_field_name AS P1 parent_select_body ) |
29
( GRANDPARENT1 . int_field_name , GRANDPARENT1 . int_field_name ) IN ( SELECT select_option PARENT1 . int_field_name AS P1 , PARENT1 . int_field_name AS P2 parent_select_body ) |
30
( GRANDPARENT1 . char_field_name , GRANDPARENT1 . char_field_name ) IN ( SELECT select_option PARENT1 . char_field_name AS P1 , PARENT1 . char_field_name AS P2 parent_select_body ) ;
32
grandparent_group_having_order_limit:
33
grandparent_group_by grandparent_having grandparent_order_by grandparent_limit |
34
grandparent_group_by grandparent_having grandparent_limit |
35
grandparent_having grandparent_order_by grandparent_limit |
39
GROUP BY GRANDPARENT1 . field_name ;
42
ORDER BY GRANDPARENT1 . field_name ;
45
| HAVING G1 arithmetic_operator value;
56
table_name AS PARENT1 |
57
table_name AS PARENT1 LEFT JOIN table_name AS PARENT2 USING ( field_name ) |
58
table_name AS PARENT1 LEFT JOIN table_name AS PARENT2 ON ( parent_join_condition ) ;
60
parent_join_condition:
61
PARENT1 . int_field_name arithmetic_operator PARENT2 . int_field_name |
62
PARENT1 . char_field_name arithmetic_operator PARENT2 . char_field_name ;
65
| WHERE parent_subquery_expr AND parent_condition
66
| WHERE parent_condition ;
69
| ORDER BY PARENT1 . field_name ;
72
PARENT1 . int_field_name IN ( SELECT select_option CHILD1 . int_field_name AS C1 child_select_body ) |
73
GRANDPARENT1 . int_field_name IN ( SELECT select_option CHILD1 . int_field_name AS C1 child_select_body ) |
75
PARENT1 . char_field_name IN ( SELECT select_option CHILD1 . char_field_name AS C1 child_select_body ) |
76
GRANDPARENT1 . char_field_name IN ( SELECT select_option CHILD1 . char_field_name AS C1 child_select_body ) |
78
( PARENT1 . int_field_name , PARENT1 . int_field_name ) IN ( SELECT select_option CHILD1 . int_field_name AS C1 , CHILD1 . int_field_name AS C2 child_select_body ) |
79
( PARENT1 . int_field_name , GRANDPARENT1 . int_field_name ) IN ( SELECT select_option CHILD1 . int_field_name AS C1 , CHILD1 . int_field_name AS C2 child_select_body ) |
81
( PARENT1 . char_field_name , PARENT1 . char_field_name ) IN ( SELECT select_option CHILD1 . char_field_name AS C1 , CHILD1 . char_field_name AS C2 child_select_body ) ;
82
( PARENT1 . char_field_name , GRANDPARENT1 . char_field_name ) IN ( SELECT select_option CHILD1 . char_field_name AS C1 , CHILD1 . char_field_name AS C2 child_select_body ) ;
84
( PARENT1 . char_field_name , PARENT1 . char_field_name ) IN ( SELECT select_option CHILD1 . char_field_name AS C1 , CHILD1 . char_field_name AS C2 child_select_body ) ;
85
( PARENT1 . int_field_name , PARENT1 . int_field_name ) IN ( SELECT select_option CHILD1 . int_field_name AS C1 , CHILD1 . int_field_name AS C2 child_select_body ) ;
93
table_name AS CHILD1 |
94
table_name AS CHILD1 LEFT JOIN table_name AS CHILD2 USING ( field_name ) |
95
table_name AS CHILD1 LEFT JOIN table_name AS CHILD2 ON ( child_join_condition ) ;
98
CHILD1 . int_field_name arithmetic_operator CHILD2 . int_field_name |
99
CHILD1 . char_field_name arithmetic_operator CHILD2 . char_field_name ;
102
| WHERE child_condition ;
105
| ORDER BY CHILD1 . field_name ;
108
( GRANDPARENT1 . expression ) |
109
( PARENT1 . expression ) |
110
( CHILD1 . expression ) |
111
( child_condition_bottom logical_operator child_condition ) |
112
( child_condition_bottom logical_operator parent_condition ) |
113
( child_condition_bottom logical_operator grandparent_condition ) ;
115
child_condition_bottom:
117
( CHILD1 . expression ) |
119
( CHILD1 . int_field_name arithmetic_operator CHILD1 . int_field_name ) |
120
( CHILD1 . date_field_name arithmetic_operator CHILD1 . date_field_name ) |
121
( CHILD1 . char_field_name arithmetic_operator CHILD1 . char_field_name ) |
123
( CHILD1 . int_field_name arithmetic_operator PARENT1 . int_field_name ) |
124
( CHILD1 . date_field_name arithmetic_operator PARENT1 . date_field_name ) |
125
( CHILD1 . char_field_name arithmetic_operator PARENT1 . char_field_name ) |
127
( CHILD1 . int_field_name arithmetic_operator GRANDPARENT1 . int_field_name ) |
128
( CHILD1 . date_field_name arithmetic_operator GRANDPARENT1 . date_field_name ) |
129
( CHILD1 . char_field_name arithmetic_operator GRANDPARENT1 . char_field_name ) ;
131
grandparent_condition:
132
grandparent_condition_bottom |
133
( grandparent_condition logical_operator grandparent_condition_bottom ) ;
135
grandparent_condition_bottom:
136
GRANDPARENT1 . expression ;
139
field_name null_operator |
140
int_field_name int_expression |
141
date_field_name date_expression |
142
char_field_name char_expression ;
145
arithmetic_operator digit ;
148
arithmetic_operator date | BETWEEN date AND date;
151
arithmetic_operator _varchar(1);
154
( GRANDPARENT1 . expression ) |
155
( PARENT1 . expression ) |
156
( parent_condition_bottom logical_operator parent_condition ) |
157
( parent_condition_bottom logical_operator grandparent_condition ) ;
159
parent_condition_bottom:
160
( PARENT1 . expression ) |
162
( PARENT1 . int_field_name arithmetic_operator PARENT1 . int_field_name ) |
163
( PARENT1 . date_field_name arithmetic_operator PARENT1 . date_field_name ) |
164
( PARENT1 . char_field_name arithmetic_operator PARENT1 . char_field_name ) |
166
( PARENT1 . int_field_name arithmetic_operator GRANDPARENT1 . int_field_name ) |
167
( PARENT1 . date_field_name arithmetic_operator GRANDPARENT1 . date_field_name ) |
168
( PARENT1 . char_field_name arithmetic_operator GRANDPARENT1 . char_field_name ) ;
170
null_operator: IS NULL | IS NOT NULL | IS UNKNOWN ;
175
arithmetic_operator: = | > | < | <> | >= | <= ;
178
int_field_name | char_field_name | date_field_name;
181
`pk` | `int_key` | `int_nokey` ;
184
`date_key` | `date_nokey` | `datetime_key` | `datetime_nokey` | `time_key` | `time_nokey` ;
187
`varchar_key` | `varchar_nokey` ;
192
value: _digit | _date | _time | _datetime | _varchar(1) | NULL ;