lava-oushudb-dt-sql-parser/test/parser/hive/syntax/fixtures/merge.sql
Hayden 885b85e842
Test/hive dml (#155)
* feat: add showIndex parser rule

* test: uncomment show index test cases

* test: add unit tests about DML syntax to HiveSQL

* test: add unit tests about export and import syntax to HiveSQL

* refactor: recompile hive grammar

* test: correct description of HiveSQL unit tests
2023-09-06 15:15:04 +08:00

11 lines
390 B
SQL

MERGE INTO demo.a AS T1 USING demo.b AS T2
ON T1.id = T2.id
WHEN MATCHED THEN UPDATE SET name = 'wf1'
WHEN NOT MATCHED THEN INSERT VALUES(T2.id,T2.name);
MERGE INTO demo.a AS T1 USING demo.b AS T2
ON T1.id = T2.id
WHEN MATCHED AND sex='male' THEN UPDATE SET name = 'wf1'
WHEN MATCHED AND sex='female' THEN UPDATE SET age = 10
WHEN NOT MATCHED AND age>10 THEN INSERT VALUES(T2.id,T2.name);