2017-08-18 20:22:56 +00:00
|
|
|
DROP TABLE IF EXISTS test.alter_test;
|
2014-04-03 15:57:36 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
CREATE TABLE test.alter_test (CounterID UInt32, StartDate Date, UserID UInt32, VisitID UInt32, NestedColumn Nested(A UInt8, S String), ToDrop UInt32) ENGINE = MergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192);
|
2014-04-03 15:57:36 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
INSERT INTO test.alter_test VALUES (1, '2014-01-01', 2, 3, [1,2,3], ['a','b','c'], 4);
|
2014-04-03 15:57:36 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
ALTER TABLE test.alter_test ADD COLUMN Added0 UInt32;
|
|
|
|
ALTER TABLE test.alter_test ADD COLUMN Added2 UInt32;
|
|
|
|
ALTER TABLE test.alter_test ADD COLUMN Added1 UInt32 AFTER Added0;
|
2014-04-03 15:57:36 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
ALTER TABLE test.alter_test ADD COLUMN AddedNested1 Nested(A UInt32, B UInt64) AFTER Added2;
|
|
|
|
ALTER TABLE test.alter_test ADD COLUMN AddedNested1.C Array(String) AFTER AddedNested1.B;
|
|
|
|
ALTER TABLE test.alter_test ADD COLUMN AddedNested2 Nested(A UInt32, B UInt64) AFTER AddedNested1;
|
2014-05-20 15:42:59 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
DESC TABLE test.alter_test;
|
2017-08-18 20:11:09 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
ALTER TABLE test.alter_test DROP COLUMN ToDrop;
|
2017-08-18 20:11:09 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
ALTER TABLE test.alter_test MODIFY COLUMN Added0 String;
|
2017-08-18 20:11:09 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
ALTER TABLE test.alter_test DROP COLUMN NestedColumn.A;
|
|
|
|
ALTER TABLE test.alter_test DROP COLUMN NestedColumn.S;
|
2017-08-18 20:11:09 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
ALTER TABLE test.alter_test DROP COLUMN AddedNested1.B;
|
2017-08-18 20:11:09 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
DESC TABLE test.alter_test;
|
2017-08-18 20:11:09 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
SELECT * FROM test.alter_test;
|
2017-08-18 20:11:09 +00:00
|
|
|
|
2017-08-18 20:22:56 +00:00
|
|
|
DROP TABLE test.alter_test;
|