The CREATE DATABASE statement creates a database.
Create a database
Note
You can create up to 2,048 databases in each cluster.
Syntax
CREATE DATABASE [IF NOT EXISTS] db_nameParameter
db_name: The name of the database. The naming conventions are as follows:The name can be up to 64 characters in length.
The name must start with a lowercase letter.
The name can contain letters, digits, and underscores (_).
The name cannot contain consecutive underscores (_).
The name cannot be the same as that of the built-in analyticdb database.
ImportantYou cannot modify the name of a database after it is created.
Example
CREATE DATABASE adb_demo;
Use a database
After a database is created, you can run the USE db_name command to switch to that database.
Syntax
USE adb_demo;Example
USE adb_demo; SHOW tables; +------------------------------+ | Tables_in_adb_demo | +------------------------------+ | customer | | test_table | +------------------------------+