# Create Schema/Database

__*lower_case_table_names*__

+ syntax:
  + `CREATE DATABASE [IF NOT EXISTS] database_name [options];` 
  + `CREATE SCHEMA [IF NOT EXISTS] schema_name [options];` 
+ Objects in the database can only be named using English letters, numbers, and underscores
  + The name cannot exceed 64 characters
  + Some characters cannot be used, including `ASCII(0), ASCII(255), /, \, .`   
  + You can use reserved words and special characters, but only if you enclose them in backquotes
+ TiDB stores object names in a case-sensitive manner, but compares them in a case-insensitive manner
+ drop database: `DROP DATABASE [IF EXISTS] database_name;`  
  + Be careful that this is an action that cannot be undone

```11
tidb> show variables like 'lower_case_%';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | 1     |
| ~!@lower_case_table_names@!~ | 2     |
+------------------------+-------+
```

------------------------------------------------------------
Database names are recommended to be distinguished by business, product line, or other metrics, and generally do not exceed 20 characters.

Currently, TiDB only supports setting the lower-case-table-names value to 2, that is, table names are saved case sensitively and compared in lowercase (case insensitive).

CREATE DATABASE is used to create a database, and you can specify the default properties of the database (such as the database default character set, collation). The CREATE SCHEMA and CREATE DATABASE operations

```
CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
    [create_specification] ...
```

```
create_specification:
    [DEFAULT] CHARACTER SET [=] charset_name
  | [DEFAULT] COLLATE [=] collation_name
```

An error is reported when creating a database that already exists and IF NOT EXISTS is not specified.

The create_specification option specifies database-specific CHARACTER SET and COLLATE. Currently, TiDB only supports partial character sets and collation, which will be explained in the next section.


Note: Dropping objects in TiDB can sometimes be undone, depending on GC settings etc. This is what flashback table does and similar functionality. We will talk about flashback table later.
