~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to conf/subquery-5.1.yy

initial import from internal tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
query: select ;
 
2
 
 
3
select: 
 
4
        SELECT select_option outer_select_item
 
5
        FROM outer_from
 
6
        WHERE subquery_expression logical_operator outer_condition_top
 
7
        outer_group_by outer_having outer_order_by limit;
 
8
 
 
9
outer_select_item:
 
10
        OUTR . field_name AS X |
 
11
        aggregate_function OUTR . field_name ) AS X;
 
12
 
 
13
aggregate_function:
 
14
        AVG( |
 
15
        BIT_AND( | BIT_OR( | BIT_XOR( |
 
16
        COUNT(DISTINCT | COUNT( |
 
17
        MIN( | MIN(DISTINCT |
 
18
        MAX( | MAX(DISTINCT |
 
19
        STD( | STDDEV_POP( | STDDEV_SAMP( |
 
20
        SUM( | SUM(DISTINCT |
 
21
        VAR_POP( | VAR_SAMP( | VARIANCE( |
 
22
        GROUP_CONCAT( | 
 
23
        AVG(DISTINCT ;
 
24
 
 
25
outer_from:
 
26
        outer_table_name AS OUTR |
 
27
        outer_table_name AS OUTR2 LEFT JOIN outer_table_name AS OUTR ON ( outer_join_condition );
 
28
 
 
29
outer_join_condition:
 
30
        OUTR2 . int_field_name arithmetic_operator OUTR . int_field_name |
 
31
        OUTR2 . date_field_name arithmetic_operator OUTR . date_field_name |
 
32
        OUTR2 . char_field_name arithmetic_operator OUTR . char_field_name ;
 
33
 
 
34
outer_order_by:
 
35
        ORDER BY OUTR . field_name , OUTR . `pk` ;
 
36
 
 
37
outer_group_by:
 
38
        | GROUP BY OUTR . field_name ;
 
39
 
 
40
outer_having:
 
41
        | HAVING X arithmetic_operator value ;
 
42
 
 
43
limit:
 
44
        | LIMIT digit ;
 
45
 
 
46
select_inner_body:
 
47
        FROM inner_from
 
48
        WHERE inner_condition_top
 
49
        inner_order_by;
 
50
 
 
51
select_inner:
 
52
        SELECT select_option inner_select_item
 
53
        select_inner_body;
 
54
 
 
55
select_inner_one_row:
 
56
        SELECT select_option inner_select_item
 
57
        select_inner_body LIMIT 1;
 
58
 
 
59
select_inner_two_cols:
 
60
        SELECT select_option inner_select_item , INNR . field_name AS Z 
 
61
        select_inner_body;
 
62
 
 
63
inner_order_by:
 
64
        | ORDER BY INNR . field_name ;
 
65
 
 
66
inner_group_by:
 
67
        | GROUP BY INNR . field_name ;
 
68
 
 
69
inner_having:
 
70
        | HAVING X arithmetic_operator value;
 
71
 
 
72
inner_select_item:
 
73
        INNR . field_name AS Y | 
 
74
        aggregate_function INNR . field_name ) AS Y ;
 
75
 
 
76
inner_from:
 
77
        inner_table_name AS INNR |
 
78
        inner_table_name AS INNR2 LEFT JOIN inner_table_name AS INNR ON ( inner_join_condition );
 
79
 
 
80
inner_join_condition:
 
81
        INNR2 . int_field_name arithmetic_operator INNR . int_field_name |
 
82
        INNR2 . date_field_name arithmetic_operator INNR . date_field_name |
 
83
        INNR2 . char_field_name arithmetic_operator INNR . char_field_name ;
 
84
 
 
85
outer_condition_top:
 
86
        outer_condition_bottom |
 
87
        ( outer_condition_bottom logical_operator outer_condition_bottom ) |
 
88
        outer_condition_bottom logical_operator outer_condition_bottom ;
 
89
 
 
90
outer_condition_bottom:
 
91
        OUTR . expression ;
 
92
 
 
93
expression:
 
94
        field_name null_operator |
 
95
        int_field_name int_expression |
 
96
        date_field_name date_expression |
 
97
        char_field_name char_expression ;
 
98
 
 
99
int_expression:
 
100
        arithmetic_operator digit ;
 
101
 
 
102
date_expression:
 
103
        arithmetic_operator date | BETWEEN date AND date;
 
104
 
 
105
char_expression:
 
106
        arithmetic_operator _varchar(1);
 
107
 
 
108
inner_condition_top:
 
109
        INNR . expression |
 
110
        OUTR . expression |
 
111
        inner_condition_bottom logical_operator inner_condition_bottom |
 
112
        inner_condition_bottom logical_operator outer_condition_bottom ;
 
113
 
 
114
inner_condition_bottom:
 
115
        INNR . expression |
 
116
        INNR . int_field_name arithmetic_operator INNR . int_field_name |
 
117
        INNR . date_field_name arithmetic_operator INNR . date_field_name |
 
118
        INNR . char_field_name arithmetic_operator INNR . char_field_name;
 
119
 
 
120
null_operator: IS NULL | IS NOT NULL ;
 
121
 
 
122
logical_operator: AND | OR | OR NOT | XOR | AND NOT ;
 
123
 
 
124
arithmetic_operator: = | > | < | <> | >= | <= ;
 
125
 
 
126
subquery_expression:
 
127
        EXISTS ( select_inner ) |
 
128
        NOT EXISTS ( select_inner ) |
 
129
        OUTR . field_name IN ( select_inner ) |
 
130
        ( OUTR . field_name , OUTR . field_name ) IN ( select_inner_two_cols ) |
 
131
        OUTR . field_name NOT IN ( select_inner ) |
 
132
        ( OUTR . field_name , OUTR . field_name ) NOT IN ( select_inner_two_cols ) |
 
133
        OUTR . field_name arithmetic_operator ( select_inner_one_row ) |
 
134
        OUTR . field_name arithmetic_operator subquery_word ( select_inner ) |
 
135
        value IN ( select_inner ) |
 
136
        value NOT IN ( select_inner );
 
137
 
 
138
subquery_word: SOME | ANY | ALL ;
 
139
 
 
140
field_name:
 
141
        int_field_name | char_field_name | date_field_name ;
 
142
 
 
143
int_field_name:
 
144
        `pk` | `int_key` | `int_nokey` ;
 
145
 
 
146
date_field_name:
 
147
        `date_nokey` | `datetime_nokey` | `date_key` | `datetime_key` ;
 
148
 
 
149
 
 
150
char_field_name:
 
151
        `varchar_key` | `varchar_nokey` ;
 
152
 
 
153
outer_table_name:
 
154
        A | B | C ;
 
155
 
 
156
inner_table_name:
 
157
        AA | BB | CC ;
 
158
 
 
159
value: digit | date | time | datetime | _varchar(1) | NULL ;
 
160
 
 
161
select_option: | ;