Mysql study note 6 (Data Definition Language DDL)
The SQL language includes four main programming languages: Data Definition Language (DDL), data operation language (DML), and data control language (DCL) there is also a transaction control language (TCL ).
※Data Definition Language (DDL), such as CREATE, DROP, and ALTER statements.
※Data Operation Language (DML), such as INSERT, UPDATE, and DELETE statements.
※Data Query Language (DQL), for example, SELECT statement. (Generally, it is not classified as one type, because there is only one statement ).
※Data control language (DCL), such as GRANT and REVOKE statements.
※Transaction control statement (TCL), such as COMMIT and ROLLBACK.
Database objects: databases, tables, views, indexes, and triggers)
The first five sections show that the data definition language is used to manipulate database objects.
Create 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
3. alter (create or replace) table tablename add index | key indexname (columnname [(length)] [asc | desc])
Drop Object Name
1. drop database db_name
2. drop table t_name
3. alter table tablename drop columnname (this is 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 review. Pay attention to the review of the specific statement expression.