The SQL language consists of four types of main programming language categories: Data definition Language (DDL), Data Manipulation language (DML) and Data Control Language (DCL), and transaction Control Language (TCL).
※ Data Definition language (DDL), for example: CREATE, DROP, Alter, and so on.
※ Data Manipulation Language (DML), for example: Insert (insert), UPDATE (modify), delete (delete) statement.
※ Data Query Language (DQL), for example: SELECT statement. (This is not usually attributed to a single class, because there is only one statement).
※ Data Control Language (DCL), for example: GRANT, REVOKE, and other statements.
※ Transaction control statement (TCL), for example: COMMIT, rollback, and other statements.
database objects: Database, table, view (view), index, trigger (trigger)
through the first five sections of learning, you know that the data definition language is to manipulate database objects
Create objects Object name
1, create database db_name;
2. CREATE TABLE T_name (
Property Name Property Type
...
);
3. Create VIEW V_name
as;
4. Create index I_name (on table ...)
5, create trigger Tri_name (...)
Alter Object object name
1. ALTER TABLE TableName [Rename/modify/add/change/drop]
2. Alter VIEW viewname AS
3. Alter (create or replace) Table tablename add Index|key indexname (columnname[(length)][asc|desc])
Drop Object Object name
1. Drop Database Db_name
2. DROP table T_name
3. ALTER TABLE TableName Drop ColumnName (This is a bit special)
4. Drop View V_name[,v_name1,v_name2 ...]
5. Drop Index i_name on T_name
6. Drop Trigger Tri_name
View
1. Show databases
2. Show tables
3. Desc T_name
4. Show Triggers\g
5. Explain select * from T_index1 where id=1\g
The above is just a simple recall, the specific statement expression should also pay attention to review.
MySQL Learning note VI (Data Definition language DDL)