tencent cloud

CREATE DATABASE
Last updated: 2024-08-07 17:10:06
CREATE DATABASE
Last updated: 2024-08-07 17:10:06

Description

Supported engines: Presto and SparkSQL
Purpose: Create a database, or specify or change the storage location of a table or partitioned table.

Statement

CREATE {DATABASE|SCHEMA} [IF NOT EXISTS] database_name
[COMMENT 'database_comment']
[WITH DBPROPERTIES ('property_name' = 'property_value') [, ...]]

Parameter

DATABASE|SCHEMA: Specify the database or schema.
database_name: Database name.
database_comment: Database comment.
[WITH DBPROPERTIES ('property_name' = 'property_value') [, ...]]: Configure database parameters using key-value pairs.

Example

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 db
COMMENT 'db1_name'
WITH DBPROPERTIES('k1' = 'v1','k2' = 'v2');



Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback