Files
doris/new-docs/en/sql-manual/sql-reference-v2/Data-Definition-Statements/Create/CREATE-DATABASE.md
smallhibiscus df021dc7eb Modify create and drop docs in DDL module. (#9030)
Modify create and drop docs in DDL module.
2022-04-15 16:32:48 +08:00

2.1 KiB

title, language
title language
CREATE-DATABASE en

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 create an Iceberg database, you need to provide the following information in properties:

    PROPERTIES (
      "iceberg.database" = "iceberg_db_name",
      "iceberg.hive.metastore.uris" = "thrift://127.0.0.1:9083",
      "iceberg.catalog.type" = "HIVE_CATALOG"
    )
    

    illustrate:

    • ceberg.database : the library name corresponding to Iceberg;
    • iceberg.hive.metastore.uris : hive metastore service address;
    • iceberg.catalog.type: The default is HIVE_CATALOG; currently only HIVE_CATALOG is supported, and more Iceberg catalog types will be supported in the future.

Example

  1. Create a new database db_test

    CREATE DATABASE db_test;
    
  2. Create a new Iceberg database iceberg_test

    CREATE DATABASE `iceberg_test`
    PROPERTIES (
    "iceberg.database" = "doris",
    "iceberg.hive.metastore.uris" = "thrift://127.0.0.1:9083",
    "iceberg.catalog.type" = "HIVE_CATALOG"
    );
    

Keywords

CREATE, DATABASE

Best Practice