MySQL Database language classification

Source: Internet
Author: User
Tags savepoint

Data definition Language: language, referred to as DDL, including Createdrop alter statements

Create table/database table name/database name;

drop table name; (Both records and structure are deleted)

Alter table name Add column adds a new list name type;

ALTER TABLE name modify column name type; (Modify the properties of the column in the table)

Alter Table name change column (can omit) old column name new name type;


Data manipulation language: manipulation language, referred to as DML, which includes insertupdate DELETE statements

Insert into table name (column name, column name, ...) Values (value 1, value 2, ...) );

Update table Name set column name = new value, column name = new value where column name = value;

Delete from table name where column name = value; (Delete records only, do not delete structure)

Query Language: Data Retrieval language, abbreviated DRL, which includes a SELECT statement

Dual is a virtual table that can be used to calculate, for example: select 1+3 ' sum ' from Dual;



Transaction Control Language: Transaction Control Language, abbreviated as TCL, which includes commit,rollback and other statements.


Definition of a transaction: a multi-step operation on a database, each step is equivalent to a transaction


The default commit of a transaction is automatically committed, which is autocommit=true


Transaction savepoint: SavePoint Prerequisite: You must set manual commit, or set autocommit=false.

Update teacher_tab set gender= ' m ' whereid=2;

Delete from Teacher_tab where id=8;

SavePoint P1;


Delete from Teacher_tab where id=7;


At this time if the id=7 record is considered to be a false deletion, if you want to recover, you can use rollback to rollback, that is, rollback to P1, the record is restored.

If you use rollback directly, all previous operations are restored.


MySQL, database, definition, database language


This article is from the "Phenex" blog, make sure to keep this source http://phenex.blog.51cto.com/10579566/1680783

MySQL Database language classification

Related Article

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.