Create a database
This document describes how to use SQL to create a database and the rules that should be followed when creating a database.
Note
Here only a brief description of the CREATE DATABASE statement. For more information, see CREATE DATABASE.
Prepare before starting
Before reading this page, you need to prepare the following:
- Create instance has been completed.
- Understand what database schema is.
What is a database
In MatrixOne Intelligence, database objects can contain tables, views and other objects.
Create a database
The CREATE DATABASE statement can be used to create a database.
CREATE DATABASE IF NOT EXISTS `modatabase`;
This statement creates a database named modatabase if it does not exist yet.
To view all databases, execute a SHOW DATABASES statement on the command line:
SHOW DATABASES;
The running result is:
+-------------------------+
| Database |
+-------------------------+
| mo_catalog |
| system |
| system_metrics |
| mysql |
| information_schema |
| modabase |
+-------------------------+
Rules that should be followed when creating a database
-
You can use the
CREATE DATABASEstatement to create a database and use theUSE {databasename};statement in a SQL session to use the database you created. -
When a tenant or user creates a new database, role, or child user, only the necessary permissions are granted to the tenant or user, see Access Control in MatrixOne Intelligence.
-
You have prepared the modatabase database and you can add tables to the database, see the next chapter [Create table] (create-table.md).