MySQL-- database CRUD operations

CRUD operation and use of the database

  • C (Create): Creating

1. Create a database: create database database name;
2. Create a database to determine whether there is another: create database if not exists Database name;
Here Insert Picture Description
3. Create a database and specify the character set: create database database name of the character set the character set;
Here Insert Picture Description
4. Integrated: Create database S3, determines whether there is, and specifies the character set to GBK
Create character database iF Not eXISTS S3 sET GBK;

  • R (Retriev): inquiry

1. All queries the database name: Show Databases; Here Insert Picture Description
2. query a database character set (see Creating a database statement): show create database database name;
Here Insert Picture Description

  • U (Update): Modify

1. Modify the character set of the database: alter database database name of the character set the character set names;
Here Insert Picture Description

  • D (Delete): Delete (very dangerous not recommended.)

1. Delete the database: drop database database name;
Here Insert Picture Description
2. determine the database exists, there is then deleted: drop database if exists database name;
Here Insert Picture Description

  • Using a database (the database can be seen as a folder inside the structure seen in Table folder contents in storage)

1. query the database currently in use: the SELECT Database ();
2. Use Database (equivalent access to the database (into the folder)): use database name;
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/LiLiLiLaLa/article/details/92432289