CREATE TABLE table_03002 (ts DateTime, event_type String) ENGINE = MergeTree ORDER BY (event_type, ts); CREATE MATERIALIZED VIEW mv_03002 TO table_03002 AS SELECT ts FROM table_03002; SHOW CREATE TABLE mv_03002; ALTER TABLE mv_03002 MODIFY QUERY WITH MY_CTE AS (SELECT ts FROM table_03002) SELECT * FROM MY_CTE; SHOW CREATE TABLE mv_03002; DROP TABLE mv_03002; DROP TABLE table_03002;