ClickHouse/tests/queries/0_stateless/02692_multiple_joins_unicode.sql
2023-03-23 15:50:56 +01:00

25 lines
827 B
SQL

DROP TABLE IF EXISTS store;
DROP TABLE IF EXISTS location;
DROP TABLE IF EXISTS sales;
CREATE TABLE store (id UInt32, "名称" String, "状态" String) ENGINE=MergeTree() Order by id;
CREATE TABLE location (id UInt32, name String) ENGINE=MergeTree() Order by id;
CREATE TABLE sales ("日期" Date, "店铺" UInt32, "地址" UInt32, "销售额" Float32) ENGINE=MergeTree() Order by "日期";
INSERT INTO store VALUES (1,'店铺1','启用'),(2,'店铺2','停用');
INSERT INTO location VALUES (1,'上海市'),(2,'北京市');
INSERT INTO sales VALUES ('2021-01-01',1,1,10),('2021-01-02',2,2,20);
SELECT
``,
location.name,
store.``
FROM sales
LEFT JOIN store ON store.id = ``
LEFT JOIN location ON location.id = ``
ORDER BY 1, 2, 3;
DROP TABLE store;
DROP TABLE location;
DROP TABLE sales;