SnowConvert AI - Hive - CREATE TABLE¶
Applies to
Hive SQL
Spark SQL
Databricks SQL
Description¶
Creates a new table in the current database. You define a list of columns, which each hold data of a distinct type. The owner of the table is the issuer of the CREATE TABLE command.
For more information, please refer to CREATE TABLE (https://spark.apache.org/docs/3.5.3/sql-ref-syntax-ddl-create-table.html) documentation.
Grammar Syntax ¶
IF NOT EXISTS ¶
Description¶
Ensures the table is created only if it does not already exist, preventing duplication and errors in your SQL script.
Hint
This syntax is fully supported in Snowflake.
Applies to¶
Hive
Spark
Databricks
Grammar Syntax¶
Sample Source Patterns¶
Input Code:¶
Output Code:¶
PARTITION BY¶
Description¶
Partitions are created on the table, based on the columns specified.
This syntax is not needed in Snowflake.
Applies to¶
Hive
Spark
Databricks
Grammar Syntax¶
Sample Source Patterns¶
Input Code:¶
Output Code:¶
CLUSTERED BY¶
Description¶
Partitions created on the table will be bucketed into fixed buckets based on the column specified for bucketing.
This grammar is partially supported
Applies to¶
Hive
Spark
Databricks
Grammar Syntax¶
The
CLUSTERED BYclause, used for performance optimization, will be converted toCLUSTER BYin Snowflake. Performance may vary between the two architectures.The
SORTED BYclause can be removed during migration, as Snowflake automatically handles data sorting within its micro-partitions.The
INTO BUCKETSclause, a SparkSQL/Databrick specific partitioning setting, should be entirely eliminated, as it’s not applicable in Snowflake.
Sample Source Patterns¶
Input Code:¶
Output Code:¶
ROW FORMAT¶
Description¶
Specifies the row format for input and output.
This grammar is not supported in Snowflake
Applies to¶
Hive
Spark
Databricks
Grammar Syntax¶
Sample Source Patterns¶
Input Code:¶
Output Code:¶
STORED AS¶
Description¶
File format for table storage.
This grammar is not supported in Snowflake
Applies to¶
Hive
Spark
Databricks