Database must be known in SQL four languages: DDL DML DCL TCL

Source: Internet
Author: User
Tags savepoint

Today in the group discussion, DDL or DML, I this small white or summed up their differences.

1. Ddl–data Definition Language

Database Definition language: Defines the structure of the database.

The main orders are Create,alter,drop, and so on, the following examples are detailed. This language does not require a commit, so be cautious.

Create–to create objects in the database creating objects

Example: CREATE DATABASE test; To create a database named Test

Alter–alters the structure of the database structure

Example: ALTER TABLE test ADD birthday date; Modify test table to add Birthday column of date type

Drop–delete objects from the database to delete objects from databases

Example: Drop database test;//Delete test databases

There are other:

truncate– TRUNCATE TABLE content (development period, still quite common)

comment– adding notes to a data dictionary

2. Dml–data Manipulation Language

Database manipulation Language: processing data in a database in SQL

Its main orders have Select,insert,update,delete, and so on, these examples are often not introduced. The language requires a commit. There are also commonly used lock TABLE, remember to write a locked blog – portal

There are other unfamiliar:

call– call a PL/SQL or Java subroutine
EXPLAIN plan– Parse Data access path

3. Dcl–data Control Language

Database Control Language: Authorization, role control, etc.

grant– granting access to users

revoke– Revoke authorization rights

4. Tcl–transaction Control Language

Transaction Control Language

commit– saving the work that has been done

savepoint– setting a savepoint in a transaction can be rolled back here

rollback– rollback

SET transaction– Change transaction options

Database must be known in SQL four languages: DDL DML DCL TCL (EXT)

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.