Home Database Mysql Tutorial Detailed explanation of the concepts DDL, DML, DCL, and TCL

Detailed explanation of the concepts DDL, DML, DCL, and TCL

Sep 09, 2017 pm 02:49 PM
concept explain detailed

As an experienced developer, you may not be unfamiliar with acronyms (nouns) such as DDL, DML, DCL, and TCL, but as a novice in Yiyi program development, you may have a lot of confusion. What follows? I will give you a detailed explanation, I hope it will be of some help to readers.

1. Data Definition Language DDL
DDL ((Data Definition Language): The main commands include CREATE, ALTER, DROP, etc., use Initialization work such as defining/modifying/deleting data structures, data types, links and constraints between data objects (such as tables), etc. is mostly used when creating tables. In other words, the objects operated by DDL language are objects in the database. Rather than the data contained in the object.

DDL contains the following statements:

 1、CREATE : 在数据库中创建新的数据对象
 2、ALTER : 修改数据库中对象的数据结构
 3、DROP : 删除数据库中的对象
 4、DISABLE/ENABLE TRIGGER : 修改触发器的状态
 5、UPDATE STATISTIC : 更新表/视图统计信息
 6、TRUNCATE TABLE : 清空表中数据
 7、COMMENT : 给数据对象添加注释
 8、RENAME : 更改数据对象名称
Copy after login

Note:
When executing a DDL statement, before and after each statement, the database (oracle/ Mysql) will submit the current transaction. If the user executes a DDL statement (such as create table) after using the insert command, the data from the insert command will be submitted to the database when the DDL statement is executed. , the DDL statement will be automatically submitted and cannot be rolled back.

2. Data Manipulation Language DML
DML: used to add/delete/modify/query/merge data in the database. For example, SELECT, UPDATE, INSERT, DELETE, and MERGE operations are languages ​​used to operate table data in the database.

DML contains the following statements:

 1、INSERT :将数据插入到表或视图
 2、DELETE :从表或视图删除数据
 3、SELECT :从表或视图中获取数据
 4、UPDATE :更新表或视图中的数据
 5、MERGE : 对数据进行合并操作(插入/更新/删除)
Copy after login

Note:
If the DML command is not submitted, it will not be seen by other sessions. Unless the DDL command or DCL command is executed after the DML command, or the user exits the session, or terminates the instance, the system will automatically issue a commit command. Submit unsubmitted DML commands.

3. Data Control Language DCL
DCL (Data Control Language): is a statement used to set or change database user or role permissions, including (grant, deny, revoke, etc.).

DCL contains the following statements:

 1、GRANT : 赋予用户某种控制权限
 2、REVOKE :取消用户某种控制权限
Copy after login

The data control language only needs to create, delete, change passwords, and grant permissions and delete permissions to users. Operation.

4. Transaction Control Language (TCL)
TCL (Transaction Control Language): Used to manage transactions.

TCL contains the following statements:

  1、COMMIT : 保存已完成事务动作结果
  2、SAVEPOINT : 保存事务相关数据和状态用以可能的回滚操作
  3、ROLLBACK : 恢复事务相关数据至上一次COMMIT操作之后
  4、SET TRANSACTION : 设置事务选项
Copy after login

Since DML statements will add row-level locks when operating table data, after the confirmation is completed, the command COMMIT to end the transaction must be added to officially take effect, otherwise the changes may not be written to the database if you want to withdraw them. operation, can be restored with the command ROLLBACK.
Before running INSERT, DELETE and UPDATE statements, it is best to estimate the record range of possible operations. It should be limited to a smaller range, such as 10,000 records, otherwise ORACLE will use a large rollback to process this matter. part. The program responds slowly or even becomes unresponsive. If there are hundreds of thousands or more of these operations recorded. These SQL statements can be completed in sections. Add COMMIT to confirm the transaction processing.

According to the different target of statement operation, it is still easy to distinguish these four types: DDL-data object; DML-data; DCL-permission; TCL-transaction.
The only thing that needs attention is TRUNCATE. Although it is functionally equivalent to DELETE all the data in the table, it operates on the table level instead of row (when the table data cannot be deleted immediately for some reason, TRUNCATE will lock the entire table, while DELETE locks row), so it is included in DDL.​​

The above is the detailed content of Detailed explanation of the concepts DDL, DML, DCL, and TCL. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the analysis of 2.8k screen? What is the analysis of 2.8k screen? Jan 02, 2024 pm 12:21 PM

We often see the introduction of how many K screens we have when buying TVs, computers or mobile phones, such as 2.8K screens. At this time, there will be friends who don’t know much about electronic devices and will be curious about what this 2.8K screen means and what the resolution is. What does 2.8k screen mean? Answer: 2.8k screen means that the screen resolution is 2880*18002K, which means the number of horizontal pixels is greater than 2000. For the same size screen, the higher the resolution, the better the picture quality. Introduction to resolution 1. Since the points, lines and surfaces on the screen are all composed of pixels, the more pixels the monitor can display, the finer the picture, and the more information can be displayed in the same screen area. 2. The higher the resolution, the greater the number of pixels, and the sharper the sensed image.

What does the metaverse concept mean? What is the metaverse concept? What does the metaverse concept mean? What is the metaverse concept? Feb 22, 2024 pm 03:55 PM

The Metaverse is an illusory world that uses technology to map and interact with the real world. Analysis 1 Metaverse [Metaverse] is an illusory world that makes full use of technological methods to link and create, and maps and interacts with the real world. It is a data living space with the latest social development system. The 2-dimensional universe is essentially a virtual technology and digital process of the real world, which requires a lot of transformation of content production, economic system, customer experience and physical world content. 3 However, the development trend of the metaverse is gradual. It is finally formed by the continuous combination and evolution of many tools and platforms with the support of shared infrastructure, standards and protocols. Supplement: What is the metaverse composed of? 1 The metaverse is composed of Meta and Verse, Meta is transcendence, and V

Write a Java program to calculate the area and perimeter of a rectangle using the concept of classes Write a Java program to calculate the area and perimeter of a rectangle using the concept of classes Sep 03, 2023 am 11:37 AM

The Java language is one of the most commonly used object-oriented programming languages ​​in the world today. The concept of classes is one of the most important features of object-oriented languages. A class is like a blueprint for an object. For example, when we want to build a house, we first create a blueprint of the house, in other words, we create a plan that shows how we are going to build the house. According to this plan we can build many houses. Likewise, using classes, we can create many objects. Classes are blueprints for creating many objects, where objects are real-world entities like cars, bikes, pens, etc. A class has the characteristics of all objects, and the objects have the values ​​of these characteristics. In this article, we will write a Java program to find the perimeter and faces of a rectangle using the concept of classes

Learn more about Gunicorn's fundamentals and features Learn more about Gunicorn's fundamentals and features Jan 03, 2024 am 08:41 AM

Basic concepts and functions of Gunicorn Gunicorn is a tool for running WSGI servers in Python web applications. WSGI (Web Server Gateway Interface) is a specification defined by the Python language and is used to define the communication interface between web servers and web applications. Gunicorn enables Python web applications to be deployed and run in production environments by implementing the WSGI specification. The function of Gunicorn is to

Master the key concepts of Spring MVC: Understand these important features Master the key concepts of Spring MVC: Understand these important features Dec 29, 2023 am 09:14 AM

Understand the key features of SpringMVC: To master these important concepts, specific code examples are required. SpringMVC is a Java-based web application development framework that helps developers build flexible and scalable structures through the Model-View-Controller (MVC) architectural pattern. web application. Understanding and mastering the key features of SpringMVC will enable us to develop and manage our web applications more efficiently. This article will introduce some important concepts of SpringMVC

Introduction and core concepts of Oracle RAC Introduction and core concepts of Oracle RAC Mar 07, 2024 am 11:39 AM

Introduction and core concepts of OracleRAC (RealApplicationClusters) As the amount of enterprise data continues to grow and the demand for high availability and high performance becomes increasingly prominent, database cluster technology becomes more and more important. OracleRAC (RealApplicationClusters) is designed to solve this problem. OracleRAC is a high-availability, high-performance cluster database solution launched by Oracle.

What is the Oracle home directory? Detailed explanation of the concept and function of Oracle home directory What is the Oracle home directory? Detailed explanation of the concept and function of Oracle home directory Mar 08, 2024 am 08:18 AM

Title: Oracle Master Catalog: Concepts, Functions and Code Examples The master catalog (MasterCatalog) in the Oracle database is the basic directory structure of the database and is used to store metadata about database objects and other database information. The home directory plays the role of the management center of the database, recording information about all objects in the database, such as tables, indexes, views, users, etc., and also includes database configuration information and permission information. In Oracle database, the concept of home directory is very important, it is used

What exactly is PHP SDK? What exactly is PHP SDK? Mar 11, 2024 am 11:24 AM

PHPSDK is a software development toolkit used to assist developers to quickly and easily integrate third-party services or API interfaces in the PHP language. The full name of SDK is Software Development Kit, which is software development kit. It provides a series of functions, classes, methods and tools to make it easier for developers to interact with external services. In PHP development, SDK usually contains encapsulation of specific services to simplify the process of developers writing related code. PHPSD

See all articles