2023-12-13 07:42:43 +00:00
|
|
|
DROP TABLE IF EXISTS order_by_all;
|
|
|
|
|
|
|
|
CREATE TABLE order_by_all
|
|
|
|
(
|
|
|
|
a String,
|
2023-12-16 09:59:50 +00:00
|
|
|
b Nullable(Int32),
|
|
|
|
all int,
|
2023-12-13 07:42:43 +00:00
|
|
|
)
|
2023-12-17 03:21:46 +00:00
|
|
|
engine = Memory;
|
2023-12-13 07:42:43 +00:00
|
|
|
|
2023-12-17 03:21:46 +00:00
|
|
|
INSERT INTO order_by_all VALUES ('B', 3, 10), ('C', NULL, 40), ('D', 1, 20), ('A', 2, 30);
|
2023-12-13 07:42:43 +00:00
|
|
|
|
2023-12-16 09:59:50 +00:00
|
|
|
SELECT a, b FROM order_by_all ORDER BY ALL;
|
2023-12-17 03:21:46 +00:00
|
|
|
SELECT b, a FROM order_by_all ORDER BY ALL;
|
2023-12-16 09:59:50 +00:00
|
|
|
SELECT a, b, all FROM order_by_all ORDER BY all; -- { serverError UNEXPECTED_EXPRESSION }
|
2023-12-17 03:21:46 +00:00
|
|
|
SELECT a, b as all FROM order_by_all ORDER BY all; -- { serverError UNEXPECTED_EXPRESSION }
|
2023-12-16 09:59:50 +00:00
|
|
|
SELECT a, b, all FROM order_by_all ORDER BY all settings enable_order_by_all = false;
|
2023-12-17 03:21:46 +00:00
|
|
|
SELECT a, b as all FROM order_by_all ORDER BY all settings enable_order_by_all = false;
|
|
|
|
SELECT a, b, all FROM order_by_all ORDER BY all, a;
|
2023-12-16 09:59:50 +00:00
|
|
|
SELECT a, b FROM order_by_all ORDER BY ALL DESC;
|
|
|
|
SELECT b, a FROM order_by_all ORDER BY ALL NULLS FIRST;
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS order_by_all;
|
2023-12-15 03:32:07 +00:00
|
|
|
|