1. Rules for using SQL commands
1, each order must be; End
2. SQL command does not distinguish between letter case
3. Use \c to terminate the execution of the current command
2, the management of the library
1, the basic operation of the library
1. View existing libraries
show databases;
2. Create library (specify character set)
Create database library name [character set UTF8];
3. View the statement that created the library (character set)
Show create database name;
4. View your current library
Select Database ();
5. Switch the Library
Use library name;
6. View existing tables in the library
Show tables;
7. Delete Library
drop database name;
2. Naming rules for library names
1, numbers, letters, underscores, but cannot use pure numbers
2, the library name distinguishes the letter case
3. Cannot use special characters and MySQL keyword
3, the management of the table
1, the basic operation of the table
Create TABLE (specify character Set)
CREATE TABLE Table name (
Field name data type,
Field name data type,
...
Field name data type
);
2. View the character set of an existing table
Show create table table name;
3. View table structure
DESC table name;
4. Delete a table
drop table name;
4. Attention
1, all the data are stored in the form of files in the database directory
2. Database directory:/var/lib/mysql
Basic SQL commands