Basic concepts of Oracle DDL, DML, DCL, and TCL

Source: Internet
Author: User
Tags field table

 

The SQL language has two components:

DML (data manipulation language): They are SELECT, UPDATE, INSERT, and DELETE, just like their names. These four commands are used to operate the data in the database.

DDL (data definition language): DDL is more than DML. The main Commands include CREATE, ALTER, and DROP. DDL is mainly used to define or change the TABLE structure, data Types, links and constraints between tables, etc. They are mostly used when creating tables. Respondent: zhongsojun | level 3 |

There are four types of SQL languages: Data Query Language DQL and data manipulation language DML,

Data Definition Language DDL and data control language DCL.

1. Data Query Language DQL

The basic structure of Data Query Language DQL is composed of SELECT clause, FROM clause, WHERE

Query block composed of clauses:

SELECT <field table>

FROM <Table or view Name>

WHERE <query condition>

2. Data manipulation language

The data manipulation language DML has three forms:

1) INSERT: INSERT

2) UPDATE: UPDATE

3) DELETE: DELETE

 

3. Data Definition Language DDL

Data Definition Language (DDL) is used to create various objects in a database-tables, views,

Indexes, synonyms, and clustering, for example:

Create table/VIEW/INDEX/SYN/CLUSTER

 

4. Data Control Language DCL

The Data Control Language DCL is used to grant or revoke some privileges to access the database and Control

The time and Effect of database operations and transactions, and the monitoring of the database. For example:

1) GRANT: authorization.

2) ROLLBACK [WORK] TO [SAVEPOINT]: roll back TO a certain point.

ROLLBACK --- ROLLBACK

The rollback command returns the database status to the last submitted status. The format is:

SQL> ROLLBACK;

3) COMMIT [WORK]: Submit. Www.2cto.com

During database insertion, deletion, and modification operations, only when the transaction is committed to the data

The database is complete. Before the transaction is committed, only the person who operates the database can view

You can only see what you do after the final submission.

You can submit data explicitly, implicitly, or automatically. Points below

Do not describe these three types.

(1) explicit submission

You can use the COMMIT command to directly submit an object explicitly. The format is:

SQL> COMMIT;

(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, after the insert, modify, or delete statement is executed,

The system will automatically submit. The format is:

SQL> SET AUTOCOMMIT ON;

 

 

Differences between DDL, DML, and DCL

What are the difference between DDL, DML and DCL commands?

What are the differences between DDL, DML, and DCL commands? (DDL is a data definition language, for example :)

DDL is Data Definition Language statements. Some examples:

CREATE-to create objects in the database (CREATE an object in the database)

ALTER-alters the structure of the database (modify the database structure)

DROP-delete objects from the database (delete objects from the database)

TRUNCATE-remove all records from a table, including all spaces allocated for the records are removed (remove all records from a table, including all space allocated for records)

COMMENT-add comments to the data dictionary (add remarks for the data dictionary)

GRANT-gives user's access privileges to database (GRANT the user access permission)

REVOKE-withdraw access privileges given with the GRANT command (REVOKE the access permission granted by the GRANT command)

DML is Data Manipulation Language statements. Some examples :( DML is the Data operation Language, such :)

 

SELECT-retrieve data from the database (return data that meets certain requirements from the specified database)

INSERT-insert data into a table (INSERT data to a table)

UPDATE-updates existing data within a table (UPDATE existing data in the table)

DELETE-deletes all records from a table, the space for the records remain (DELETE all records in the table, but keep the space of records)

CALL-call a PL/SQL or Java subprogram (CALL a PL/SQL or JAVA subroutine)

Explain plan-explain access path to data (EXPLAIN the access path of the analyzed data)

Lock table-control concurrency (control concurrency)

DCL is Data Control Language statements. Some examples :( DCL is a Data Control Language, such :)

 

COMMIT-save work done (save finished work)

SAVEPOINT-identify a point in a transaction to which you can later roll back (mark a point in the transaction so that you can roll back here later)

ROLLBACK-restore database to original since the last COMMIT (Save the database again after the last COMMIT)

Set transaction-Change transaction options like what rollback segment to use (Change TRANSACTION options)

From longtotem's blog

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.