Delete如何既是DDL又是DML语句 [英] How can Delete be both a DDL and a DML statement

查看:208
本文介绍了Delete如何既是DDL又是DML语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在阅读正式的微软书籍数据库管理基础知识,以准备参加考试。

I am currently reading the offical Microsoft book 'Database Administration Fundamentals' in preparation to sitting it's exam.

我了解DDL和DML是什么,但是Microsoft表示DELETE既是DDL又是DML语句。我已经用谷歌搜索过,但是我无法证实或否认这一点。

I understand what DDL and DML are but Microsoft show DELETE as being both a DDL and DML statement. I have googled this but I cannot anything that confirms or denies this.

对此有一个很好的参考:什么是DDL和DML ,将其显示为DML。以下是本书中的部分内容:

A good reference to this is the question: What is DDL and DML Which shows it as a DML. Below is the segments from the book:


数据操作语言(DML)是允许
使用
的核心语句INSERT,UPDATE,DELETE和MERGE可以操纵任何SQL Server表中的数据。核心DML语句包括
以下内容:•SELECT:从数据库中检索行,并使
从SQL Server中的一个或多个表
中选择一个或多个行或列。 •插入:在SQL Server的表或
视图中添加一个或多个新行。 •更新:更改表或视图中一个或多个
列中的现有数据。 •DELETE:从表或
视图中删除行。 •MERGE:根据与源表的联接结果在
目标表上执行插入,更新或删除操作。

Data Manipulation Language (DML) is the language element that allows you to use the core statements INSERT, UPDATE, DELETE, and MERGE to manipulate data in any SQL Server tables. Core DML statements include the following: • SELECT: Retrieves rows from the database and enables the selection of one or many rows or columns from one or many tables in SQL Server. • INSERT: Adds one or more new rows to a table or a view in SQL Server. • UPDATE: Changes existing data in one or more columns in a table or view. • DELETE: Removes rows from a table or view. • MERGE: Performs insert, update, or delete operations on a target table based on the results of a join with a source table.

六个主要DDL语句如下:•USE:更改
数据库上下文。 •创建:创建一个SQL Server数据库对象
(表,视图或存储过程)。 •ALTER:更改现有的
对象。 •DROP:从数据库中删除对象。 •TRUNCATE:
从表中删除行并释放这些行使用的空间。 •
DELETE:从表中删除行,但不会释放
那些删除的行所使用的空间。

the six main DDL statements are as follows: • USE: Changes the database context. • CREATE: Creates a SQL Server database object (table, view, or stored procedure). • ALTER: Changes an existing object. • DROP: Removes an object from the database. • TRUNCATE: Removes rows from a table and frees the space used by those rows. • DELETE: Remove rows from a table but does not free the space used by those rows removed.

这本书是否过期/错了。有人可以帮助阐明这一点吗?我看到了完整的DDL和DML语句的冲突列表。

Is the book out of date/ wrong. Can someone help shed light on this I see conflicting lists of what are the full DDL and DML statements.

推荐答案

我同意您的观点, DELETE 是DML。此外,我敢说, TRUNCATE 也应被视为DML,因为从逻辑上讲,它等效于 DELETE 语句。 TRUNCATE DROP CREATE 的事实并非如此我认为足以证明将其分配给DDL是合理的,因为将两者作为一个原子操作一起执行不会影响数据库的架构。

I agree with you, DELETE is DML. Moreover, I dare say, TRUNCATE should also be considered DML, since logically is equivalent to a DELETE statement. The fact that TRUNCATE is a DROP and CREATE is not enough in my opinion to justify assigning it to DDL, since the two together, carried out as one atomic operation, do not affect the schema of the database.

这篇关于Delete如何既是DDL又是DML语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆