Home > Database > Mysql Tutorial > body text

What are the types of SQL commands?

青灯夜游
Release: 2019-01-21 11:18:48
Original
11823 people have browsed it

SQL commands are mainly divided into 4 types: DDL (data definition language), DML (data manipulation language), DCL (data control language), TCL (transaction control language). Let me give you a brief understanding of these four types. I hope it will be helpful to you.

What are the types of SQL commands?

Structured Query Language (SQL) is well known as database language and we can use it to perform certain operations on existing database and we can also use language to create databases. SQL uses certain commands like Create, Drop, Insert, etc. to perform the required tasks. [Recommended related video tutorials: MySQL Tutorial]

These SQL commands are mainly divided into four categories. Let’s briefly introduce them to you:

DDL (Data Definition Language)

DDL or Data Definition Language actually consists of SQL commands that can be used to define a database schema. It simply deals with the description of the database schema and is used to create and modify the structure of database objects in the database.

Commonly used DDL commands:

CREATE: Used to create a database or its objects (such as tables, indexes, functions, views, stored procedures and triggers).

DROP: Used to delete objects from the database.

ALTER: used to change the structure of the database.

TRUNCATE: Used to delete all records from the table, including all spaces assigned to the records.

COMMENT: Used to add comments to the data dictionary.

RENAME: Used to rename objects existing in the database.

DML (Data Manipulation Language)

SQL commands that handle data manipulation existing in the database belong to DML or data manipulation language. This includes large Most SQL statements.

Commonly used DML commands:

SELECT: used to retrieve data from the database.

INSERT: Used to insert data into the table.

UPDATE: Used to update existing data in the table.

DELETE: Used to delete records from the database table.

DCL (Data Control Language)

DCL includes commands such as GRANT and REVOKE, which mainly handles permissions, permissions and other controls of the database system.

Commonly used DCL commands:

GRANT: Grant users access to the database.

REVOKE: Use the GRANT command to extract the user's access rights.

TCL (Transaction Control Language)

TCL commands process transactions in the database.

Commonly used TCL commands:

COMMIT: Submit the transaction.

ROLLBACK: Roll back the transaction in case of any error.

SAVEPOINT: Set the save point in the transaction.

SET TRANSACTION: Specifies the characteristics of the transaction.

The above is the entire content of this article, I hope it will be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of What are the types of SQL commands?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!