NOTE In versions earlier than v3.0, the SHOW CREATE TABLE statement requires you to have theSince v3.0, you can use the SHOW CREATE TABLE statement to view the CREATE TABLE statements of the tables that are managed by an external catalog and are stored in Apache Hive™, Apache Iceberg, Apache Hudi, or Delta Lake. Since v2.5.7, the database can automatically set the number of buckets (BUCKETS) when you create a table or add a partition. You no longer need to manually set the number of buckets. For detailed information, see set the number of buckets.SELECT_PRIVprivilege on the table. Since v3.0, the SHOW CREATE TABLE statement requires you to have theSELECTprivilege on the table.
- If you specified the number of buckets when creating a table, the output of SHOW CREATE TABLE will display the number of buckets.
- If you did not specify the number of buckets when creating a table, the output of SHOW CREATE TABLE will not display the number of buckets. You can run SHOW PARTITIONS to view the number of buckets for each partition.
Syntax
Parameters
Output
Examples
Bucket number is not specified
Create a table namedexample_table with no bucket number specified in DISTRIBUTED BY.
example_table. No bucket number is displayed in DISTRIBUTED BY. Note that if you did not specify PROPERTIES when you create the table, the default properties are displayed in the output of SHOW CREATE TABLE.
Bucket number is specified
Create a table namedexample_table1 with bucket number set to 10 in DISTRIBUTED BY.
example_table. The bucket number (BUCKETS 10) is displayed in DISTRIBUTED BY. Note that if you did not specify PROPERTIES when you create the table, the default properties are displayed in the output of SHOW CREATE TABLE.