Mysql Study Notes 6 (Data Definition Language DDL), learning notes ddl

Source: Internet
Author: User

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.

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
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
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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.