ClickHouse/dbms/tests/queries/0_stateless/00147_alter_nested_default.sql

30 lines
956 B
MySQL
Raw Normal View History

2019-06-03 17:36:27 +00:00
DROP TABLE IF EXISTS alter_00147;
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
CREATE TABLE alter_00147 (d Date DEFAULT toDate('2015-01-01'), n Nested(x String)) ENGINE = MergeTree(d, d, 8192);
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
INSERT INTO alter_00147 (`n.x`) VALUES (['Hello', 'World']);
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
SELECT * FROM alter_00147;
SELECT * FROM alter_00147 ARRAY JOIN n;
SELECT * FROM alter_00147 ARRAY JOIN n WHERE n.x LIKE '%Hello%';
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
ALTER TABLE alter_00147 ADD COLUMN n.y Array(UInt64);
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
SELECT * FROM alter_00147;
SELECT * FROM alter_00147 ARRAY JOIN n;
SELECT * FROM alter_00147 ARRAY JOIN n WHERE n.x LIKE '%Hello%';
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
INSERT INTO alter_00147 (`n.x`) VALUES (['Hello2', 'World2']);
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
SELECT * FROM alter_00147 ORDER BY n.x;
SELECT * FROM alter_00147 ARRAY JOIN n ORDER BY n.x;
SELECT * FROM alter_00147 ARRAY JOIN n WHERE n.x LIKE '%Hello%' ORDER BY n.x;
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
OPTIMIZE TABLE alter_00147;
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
SELECT * FROM alter_00147;
SELECT * FROM alter_00147 ARRAY JOIN n;
SELECT * FROM alter_00147 ARRAY JOIN n WHERE n.x LIKE '%Hello%';
2015-04-08 21:27:35 +00:00
2019-06-03 17:36:27 +00:00
DROP TABLE alter_00147;