CREATE DATABASE
Descriptionβ
This statement is used to create a new database (database)
grammar:
CREATE DATABASE [IF NOT EXISTS] db_name
[PROPERTIES ("key"="value", ...)];
PROPERTIES
Additional information about the database, which can be defaulted.
-
If you want to specify the default replica distribution for tables in db, you need to specify
replication_allocation
(thereplication_allocation
attribute of table will have higher priority than db)PROPERTIES (
"replication_allocation" = "tag.location.default:3"
)
Exampleβ
-
Create a new database db_test
CREATE DATABASE db_test;
-
Create a new database with default replica distribution:
CREATE DATABASE `iceberg_test`
PROPERTIES (
"replication_allocation" = "tag.location.group_1:3"
);
caution
If the create table statement has attributes replication_allocation or replication_num, then the default replica distribution policy of the database will not take effect.
Keywordsβ
CREATE, DATABASE