Skip to main content
Skip to main content

CREATE-DATABASE

CREATE-DATABASE

Name

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 (the replication_allocation attribute of table will have higher priority than db)

    PROPERTIES (
    "replication_allocation" = "tag.location.default:3"
    )

Example

  1. Create a new database db_test

    CREATE DATABASE db_test;
  2. Create a new database with default replica distribution:

    CREATE DATABASE `iceberg_test`
    PROPERTIES (
    "replication_allocation" = "tag.location.group_1:3"
    );

Keywords

CREATE, DATABASE

Best Practice