SQL language division, SQL language division

Source: Internet
Author: User

SQL language division, SQL language division
In terms of functions, the SQL language can be divided into three categories: DDL, DML, and DCL.
1. DDL (Data Definition Language)
Data Definition Language, used to define and manage the languages of all objects in the SQL database;
CREATE --- CREATE a table
ALTER --- modify a table
DROP --- delete a table
RENAME --- RENAME a table
2. DML (Data Manipulation Language)
Data manipulation language. operations such as processing data in SQL are collectively referred to as data manipulation languages;
INSERT --- data insertion
REPLACE ---- same as INSERT, but will be replaced in the event of a conflict, rather than an error.
DELETE --- data deletion
UPDATE --- data modification
SELECT --- Data Query ------ calculate DQL
3. DCL (Data Control Language)
The data control language is used to grant or revoke certain privileges to access the database, control the time and Effect of database operations, and monitor the database;
GRANT --- authorize.
REVOKE -- REVOKE authorization.
ROLLBACK --- ROLLBACK.
COMMIT --- submit.

4. There are three types of data to be submitted: explicit, implicit, and automatic.

The three types are described separately below.

(1) explicit submission

You can use the COMMIT command to directly submit an object explicitly.
(2) Implicit commit

The SQL command is used for implicit submission. These commands are:

ALTER, AUDIT, COMMENT, CONNECT, CREATE, DISCONNECT, DROP, EXIT, GRANT, NOAUDIT, QUIT, REVOKE, RENAME.

(3) automatic submission

If AUTOCOMMIT is set to ON, the system automatically submits the insert, modify, and delete statements after they are executed. The format is: SQL> SET AUTOCOMMIT ON;
Be careful when using the COMMIT/ROLLBACK commands. COMMIT/ROLLBACK are used after executing DML statements (INSERT/DELETE/UPDATE/SELECT. After the DML statement is executed, the processed data will be placed in the ROLLBACK segment (except the SELECT statement), waiting for the user to submit (COMMIT) or roll back (ROLLBACK ), after you execute COMMIT/ROLLBACK, the data in the ROLLBACK segment will be deleted.

(After the SELECT statement is executed, all data has a shared pool. When the same data is queried by other users, the data is directly extracted from the shared pool without being extracted from the database, which improves the data query speed .)
All DML statements must be explicitly submitted, that is, after the DML statement is executed, the COMMIT statement must be executed. Other DDL statements are implicitly submitted. That is to say, after running those non-DML statements, the database has been implicitly committed, for example, create table. After running the script, the TABLE has been created, you do not need to submit it explicitly.

You can use rollback to roll back a transaction before committing a transaction (commit.

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.