lava-oushudb-dt-sql-parser/test/parser/mysql/syntax/fixtures/union.sql
琉易 428d851913
feat: #190 improve mysql grammer (#196)
* refactor: generic rename to mysql

* refactor: g4 with mysql syntax

* test: mysql syntax

* refactor: remove useless keywords

* refactor: remove nonReserved keywords

* refactor: lint specificFunction

---------

Co-authored-by: liuyi <liuyi@dtstack.com>
2023-11-27 15:25:40 +08:00

24 lines
799 B
SQL

-- https://dev.mysql.com/doc/refman/8.0/en/union.html
/* query_expression_body UNION [ALL | DISTINCT] query_block
[UNION [ALL | DISTINCT] query_expression_body]
[...]
query_expression_body setOperations.sql */
SELECT 1, 2 UNION SELECT 'a', 'b';
(SELECT 1 UNION SELECT 1) UNION SELECT 1;
SELECT 1 FOR UPDATE UNION SELECT 1 FOR UPDATE;
(SELECT 1 FOR UPDATE) UNION (SELECT 1 FOR UPDATE);
SELECT 1, 2 UNION ALL SELECT 'a', 'b';
SELECT 1, 2 UNION DISTINCT SELECT 'a', 'b';
(SELECT 1 UNION ALL SELECT 1) UNION ALL SELECT 1;
(SELECT 1 UNION DISTINCT SELECT 1) UNION DISTINCT SELECT 1;
(SELECT 1 UNION ALL SELECT 1) UNION DISTINCT SELECT 1;
(SELECT 1 UNION DISTINCT SELECT 1) UNION ALL SELECT 1;
(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
(SELECT 1 UNION DISTINCT SELECT 1) UNION SELECT 1;