Translation: CREATE database statement

Source: Internet
Author: User
Tags diff

This is the Official Handbook for MARIADB: The translation of CREATE database.

Original:https://mariadb.com/kb/en/create-database/
I submit it to MARIADB official manual:https://mariadb.com/kb/zh-cn/create-database/

Grammar
CREATE [OR REPLACE] {DATABASE | SCHEMA} [IF NOT EXISTS] db_name    [create_specification] ...create_specification:    [DEFAULT] CHARACTER SET [=] charset_name  | [DEFAULT] COLLATE [=] collation_name
Describe

Create database creates a db of the given name. This statement requires create permission on database. The CREATE schema is a synonym for create database. If the IF NOT EXISTS clause is used, a warning information is returned instead of returning an error when the database already exists.

OR REPLACE

MariaDB starting with 10.1.3 introduced an OR replace clause in the MariaDB 10.1.3. If an optional or replace clause is used, it is shorthand for the following statement:

DROP DATABASE IF EXISTS db_name;CREATE DATABASE db_name ...;
IF not EXISTS

When the IF NOT EXISTS clause is used, MARIADB returns a warning instead of an error message when the specified database already exists.

Example
 CREATE DATABASE db1;Query OK, 1 row affected (0.18 sec) CREATE DATABASE db1;ERROR 1007 (HY000): Can ' t Create database ' db1 ';Database exists CREATE OR REPLACE DATABASE db1;Query OK, 2 rows Affected (0.00 sec) CREATE DATABASE IF  not EXISTS db1;Query OK, 1 row affected, 1 warning (0.01 sec) SHOW WARNINGS;+-------+------+----------------------------------------------+| Level | Code | Message |+-------+------+----------------------------------------------+| Note | 1007 | Can ' t Create database ' db1 ';Database exists |+-------+------+----------------------------------------------+

Sets the character set and collation. For more information , see Setting character sets and sorting rules .

CREATE DATABASE czech_slovak_names   CHARACTER SET = ‘keybcs2‘  COLLATE = ‘keybcs2_bin‘;
back to Linux series article outline: http://www.cnblogs.com/f-ck-need-u/p/7048359.htmlback to Database series article outline: http://www.cnblogs.com/f-ck-need-u/p/7586194.htmlReprint Please specify Source: http://www.cnblogs.com/f-ck-need-u/p/7599521.htmlNote: If you think this article is not bad please click on the lower right corner of the recommendation, your support can inspire the author more enthusiasm for writing, thank you very much!

Translation: CREATE database statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.