语句如下:
select_stmt:
SELECT [ALL | DISTINCT] select_expression_list
[FROM table_reference_list]
[WHERE condition]
[GROUP BY group_expression_list [WITH ROLLUP] [HAVING condition]]
[ORDER BY order_expression_list]
[LIMIT limit_offset]
[FOR UPDATE];
| select_stmt set_operation select_stmt;
select_expression_list:
select_expression [, select_expression ...]
select_expression:
table_name.*
| table_alias_name.*
| expression [[AS] column_alias_name]
table_reference_list:
table_reference [, table_reference ...]
table_reference:
simple_table
| joined_table
simple_table:
DUAL
| table_factor [partition_option] [[AS] table_alias_name]
| (select_stmt) [AS] table_alias_name
| (table_reference_list)
joined_table:
table_reference [INNER] JOIN simple_table [join_condition]
| table_reference outer_join_type JOIN simple_table join_condition
partition_option:
PARTITION (partition_name_list)
partition_name_list:
partition_name [, partition_name ...]
outer_join_type:
{LEFT | RIGHT | FULL} [OUTER]
join_condition:
ON expression
condition:
expression
group_expression_list:
group_expression [, group_expression ...]
group_expression:
expression [ASC | DESC]
order_expression_list:
order_expression [, order_expression ...]
order_expression:
expression [ASC | DESC]
limit_offset:
offset_row_count, limit_row_count
| limit_row_count [OFFSET offset_row_count]
limit_row_count | offset_row_count:
INT_VALUE
set_operation:
UNION
| EXCEPT
| INTERSECT