MySQL Learning note VI (Data Definition language DDL)

Source: Internet
Author: User
Tags object object

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)

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.