Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 2.06 KB

sql-statement-show-create-database.md

File metadata and controls

64 lines (48 loc) · 2.06 KB
title summary
SHOW CREATE DATABASE
An overview of the use of SHOW CREATE DATABASE in the TiDB database.

SHOW CREATE DATABASE

SHOW CREATE DATABASE is used to show the exact SQL statement for re-creating an existing database. SHOW CREATE SCHEMA is a synonym for it.

Synopsis

ShowCreateDatabaseStmt:

ShowCreateDatabaseStmt ::=
    "SHOW" "CREATE" ("DATABASE" | "SCHEMA") ("IF" "NOT" "EXISTS")? DBName

Examples

CREATE DATABASE test;
Query OK, 0 rows affected (0.12 sec)
SHOW CREATE DATABASE test;
+----------+------------------------------------------------------------------+
| Database | Create Database                                                  |
+----------+------------------------------------------------------------------+
| test     | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+------------------------------------------------------------------+
1 row in set (0.00 sec)
SHOW CREATE SCHEMA IF NOT EXISTS test;
+----------+-------------------------------------------------------------------------------------------+
| Database | Create Database                                                                           |
+----------+-------------------------------------------------------------------------------------------+
| test     | CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+-------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MySQL compatibility

SHOW CREATE DATABASE is expected to be fully compatible with MySQL. If you find any compatibility differences, you can report a bug.

See also