Files
greptimedb/tests/cases/standalone/common/order/nulls_first.sql
dennis zhuang db89235474 feat: only allow timestamp type as time index (#2281)
* feat: only allow timestamp data type as time index

* test: update sqltest cases, todo: need some fixes

* fix: sqlness tests

* fix: forgot adding back cte test

* chore: style
2023-09-12 07:57:15 -05:00

26 lines
813 B
SQL

CREATE TABLE test(i INTEGER, j INTEGER, t TIMESTAMP TIME INDEX);
INSERT INTO test VALUES (1, 1, 1), (NULL, 1, 2), (1, NULL, 3);
SELECT * FROM test ORDER BY i NULLS FIRST, j NULLS LAST;
SELECT * FROM test ORDER BY i NULLS FIRST, j NULLS FIRST;
SELECT * FROM test ORDER BY i NULLS LAST, j NULLS FIRST;
SELECT i, j, row_number() OVER (PARTITION BY i ORDER BY j NULLS FIRST) FROM test ORDER BY i NULLS FIRST, j NULLS FIRST;
SELECT i, j, row_number() OVER (PARTITION BY i ORDER BY j NULLS LAST) FROM test ORDER BY i NULLS FIRST, j NULLS FIRST;
SELECT * FROM test ORDER BY i NULLS FIRST, j NULLS LAST LIMIT 2;
SELECT * FROM test ORDER BY i NULLS LAST, j NULLS LAST LIMIT 2;
SELECT * FROM test ORDER BY i;
SELECT * FROM test ORDER BY i NULLS FIRST;
SELECT * FROM test ORDER BY i NULLS LAST;
DROP TABLE test;