lava-oushudb-dt-sql-parser/test/parser/spark/syntax/fixtures/selectCase.sql
Frank d0ad381833
test: spark sql query syntax unit test (#173)
* test: add spark query unit test and check grammar

* test: add select explain、lateralSubQuery、transform unit test

* chore: fileName exchange

---------

Co-authored-by: dilu <dilu@dtstack.com>
2023-10-10 16:25:43 +08:00

11 lines
428 B
SQL

-- CASE [ expression ] { WHEN boolean_expression THEN then_expression } [ ... ]
-- [ ELSE else_expression ]
-- END
SELECT id, CASE WHEN id > 200 THEN 'bigger' ELSE 'small' END FROM person;
SELECT id, CASE id WHEN 100 then 'bigger' WHEN id > 300 THEN '300' ELSE 'small' END FROM person;
SELECT * FROM person WHERE CASE 1 = 1 WHEN 100 THEN 'big' WHEN 200 THEN 'bigger' WHEN 300 THEN 'biggest' ELSE 'small' END = 'small';