Note
Supported kernels: Presto, SparkSQL.
Purpose: To create a database, as well as to specify and modify the storage location of a table or partitioned table.
Syntax
CREATE {DATABASE|SCHEMA} [IF NOT EXISTS] database_name[COMMENT 'database_comment'][WITH DBPROPERTIES ('property_name' = 'property_value') [, ...]]
Category
DATABASE|SCHEMA: Both terms are interchangeable and can be used synonymously.database_name: Name of the database.database_comment: Database annotation.[WITH DBPROPERTIES ('property_name' = 'property_value') [, ...]]: Configure database parameters in the form of key-value pairs.Sample
Create database
db only if database with same name doesn't exist.CREATE DATABASE IF NOT EXISTS db;
Create database
db only if database with same name doesn't exist with Comment and Database Properties.CREATE DATABASE dbCOMMENT 'db1_name'WITH DBPROPERTIES('k1' = 'v1','k2' = 'v2');