lava-oushudb-dt-sql-parser/test/parser/mysql/syntax/fixtures/insertSelect.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

36 lines
913 B
SQL

-- https://dev.mysql.com/doc/refman/8.0/en/insert-select.html
/* INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name [, partition_name] ...)]
[(col_name [, col_name] ...)]
{ SELECT ...
| TABLE table_name
| VALUES row_constructor_list
}
[ON DUPLICATE KEY UPDATE assignment_list]
value:
{expr | DEFAULT}
value_list:
value [, value] ...
row_constructor_list:
ROW(value_list)[, ROW(value_list)][, ...]
assignment:
col_name =
value
| [row_alias.]col_name
| [tbl_name.]col_name
| [row_alias.]col_alias
assignment_list:
assignment [, assignment] ... */
INSERT LOW_PRIORITY IGNORE INTO tbl_temp2 (fld_id) SELECT tbl_temp1.fld_order_id FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;
INSERT HIGH_PRIORITY IGNORE INTO tbl_temp2 (fld_id) VALUES ROW(1,-2,3), ROW(5,7,9), ROW(4,6,8);