Mysql Study Notes 6 (Data Definition Language DDL), learning notes 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.
1. create database db_name;Alter object Object Name
2. create table t_name (
Property Name property type
3. create view v_name
4. create index I _name (on table ...)
5. create trigger tri_name (...)
1. alter table tablename [rename/modify/add/change/drop]Drop Object Name
2. alter view viewname
3. alter (create or replace) table tablename add index | key indexname (columnname [(length)] [asc | desc])
1. drop database db_nameView
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
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.