How to view a table's CREATE TABLE statement in ClickHouse

To get the CREATE TABLE statement of an existing table in ClickHouse, use command SHOW CREATE TABLE or simply SHOW TABLE. Both commands are equivalent:

SHOW CREATE TABLE my_table;
SHOW TABLE my_table;

Similary, to get the CREATE statement of a view:

SHOW CREATE VIEW my_view;
SHOW VIEW my_view;

Learn More

Get started with DB Pilot

DB Pilot is a Database GUI client and SQL editor for PostgreSQL, MySQL, SQLite, DuckDB & more.