DDL operations Database: Common CRUD operations
A, C (I create) to create
1. Create a database
create database database name;
2, create a database to determine whether there is, then create (if there is, it is no longer created)
create database if not exists database name;
3, create a database and specify the character set
create database database name of the character set and character set;
Demo: Creating DB1 database to determine whether there is, and to develop character set is utf8;
create database if not exists db1 character set utf8;
Two, R (Retrieve) query
1, the names of all database queries
show databases;
2, query each database character sets: a database query creation statement
show create database database name;
Three, U (Update) modified
1, modify the database character set
alter database database name of the character set the character set names;
Four, D (Delete) Delete
1, delete the database
drop database database name;
2, the database to determine whether there exists then delete
database name drop database if exists;
Fifth, use the database
1, query the database name currently in use
select database()
2, the use of database
use the database name