Updated on 2024-10-09 GMT+08:00

CREATE DATABASE

This section describes the basic SQL syntax and usage of the Doris database.

Basic Syntax

CREATE DATABASE [IF NOT EXISTS] db_name

[PROPERTIES ("key"="value", ...)];

Use Example

  1. Connect to Doris through MySQL client as a user with Doris administrator permissions.
  2. Run the following command to create the database example_db:

    create database if not exists example_db;

  3. Run the following command to view the database information:

    SHOW DATABASES;

    mysql> SHOW DATABASES;
    +--------------------+
    | Database           |
    +--------------------+
    | example_db         |
    | information_schema |
    +--------------------+
    2 rows in set (0.00 sec)

  4. Run the following command to switch to example_db:

    use example_db;