When using database languages, be sure to end with a semicolon (
;
)
CREATE DATABASE Scores;//Create a database with the specified name, and the character set uses the "specified character set when installing the database";
CREATE DATABASE database name CHARACTER SET character set;
CREATE DATABASE scores02 CHARACTER SET GBK; # Create a database with the specified name and set the specified character set;
SHOW CREATE DATABASE database name;
SHOW CREATE DATABASE scores; #View the information when a database is defined;
DROP DATABASE scores;
SELECT DATABASE();
USE database name; switch database.
USE student;
1. Create a database
CREATE DATABASE database name;CREATE DATABASE Scores;//Create a database with the specified name, and the character set uses the "specified character set when installing the database";
CREATE DATABASE database name CHARACTER SET character set;
CREATE DATABASE scores02 CHARACTER SET GBK; # Create a database with the specified name and set the specified character set;
2. View the database
SHOW DATABASES; #View "all" databases in the database MySql server, note: "DATABASES" is used here instead of "DATABASE";SHOW CREATE DATABASE database name;
SHOW CREATE DATABASE scores; #View the information when a database is defined;
3. Delete the database
DROP DATABASE database name;DROP DATABASE scores;
4. Use the database
View the database in useSELECT DATABASE();
USE database name; switch database.
USE student;