Which is more proper to call INSERT/UPDATE/DELETE statements? Command or query? I would think "command," since "query" implies that you are asking a question and expecting to get your question answered (and more information than just "yes, this operation was performed successfully, and, optionally, here's your insert ID").
哪个更适合调用INSERT / UPDATE / DELETE语句?命令或查询?我认为“命令”,因为“查询”意味着你提出一个问题,并期望得到你的问题的答案(而不仅仅是“是的,这个操作是成功执行的,并且,可选地,这里是你的插入ID”) 。
Just a question from a mid-level web application developer who was also an communications major and is one who enjoys specificity. :)
只是来自中级Web应用程序开发人员的问题,他也是一名通信专业人员,并且是一位喜欢特异性的人。 :)
3 个解决方案
#1
7
The generic term for a INSERT
, UPDATE
, DELETE
and MERGE
is an "update" (even though it is potentially confusing -- and not ideal -- that UPDATE
is merely a subset of "update"). An alternative term is "relational assignment".
INSERT,UPDATE,DELETE和MERGE的通用术语是“更新”(即使它可能令人困惑 - 并且不理想 - UPDATE仅仅是“更新”的子集)。另一个术语是“关系分配”。
The generic term for SELECT
, INSERT
, UPDATE
, DELETE
, MERGE
(and anything else terminated by a semicolon) is known as a "statement".
SELECT,INSERT,UPDATE,DELETE,MERGE(以及以分号结尾的任何其他内容)的通用术语称为“语句”。
Strictly speaking, a "query" is a SELECT
statement that returns a resultset (which would for example preclude SELECT..INTO..FROM
statements). However, using the term "query" to refer to an update, while informal, is unfortunately very common. For example, although "update query" is an oxymoron, when I do a Google search for this site using that exact term (site:*.com "update query"
) I get 17,300 hits!
严格地说,“查询”是一个返回结果集的SELECT语句(例如,它会排除SELECT..INTO..FROM语句)。但是,使用术语“查询”来指代更新,虽然是非正式的,但遗憾的是很常见。例如,虽然“更新查询”是矛盾的,但当我使用该确切术语(site:*.com“更新查询”)搜索此网站时,我会获得17,300次点击!
UPDATE (pun indended :)
更新(双关语:)
@David Marx: I disagree with your claim that it's appropriate to refer to INSERT/DELETE/MERGE as an 'update.' That would be extremely confusing. Only UPDATE is an update.
@David Marx:我不同意你的说法,即将INSERT / DELETE / MERGE称为'更新'是合适的。那将是非常混乱的。只有UPDATE才是更新。
I agreed in my original answer that the situation is potentially confusing. We are fortunate on * to be able to format answers and comments so that a keyword UPDATE
can be differentiated from a logical update; writing keywords in upper case (as required by Full Standard SQL-92 :) also helps.
我在原来的回答中同意这种情况可能令人困惑。我们很幸运能够在*上格式化答案和注释,以便可以将关键字UPDATE与逻辑更新区分开来;以大写形式编写关键字(按照完整标准SQL-92 :)的要求也有帮助。
However, from reading the general database and computing science literature, I can tell you that 'update' is indeed the correct collective term. I below provide a citation for this:
但是,通过阅读通用数据库和计算科学文献,我可以告诉你“更新”确实是正确的集体术语。我在下面提供了一个引用:
"An Introduction to Relational Database Theory" (2010), Hugh Darwen [available as a free pdf download -- Google it):
“关系数据库理论简介”(2010),Hugh Darwen [免费pdf下载 - Google it):
The different update operators expected in a relational DBMS are usually called
INSERT
,DELETE
andUPDATE
, and those are the names used in Tutorial D (also in SQL) [p.28]关系DBMS中预期的不同更新运算符通常称为INSERT,DELETE和UPDATE,这些是教程D中使用的名称(也在SQL中)[p.28]
It is regrettable that the keyword
UPDATE
has become so widely accepted as the name of just one particular operator for updating databases. Please don't shoot the messenger! [p.168]令人遗憾的是,关键字UPDATE已被广泛接受为仅用于更新数据库的一个特定运算符的名称。请不要拍信使! [第168页]
although [relational] assignment is theoretically sufficient for updating purposes, it is usually more convenient to use a shorthand expressing the difference between the current value of the target relvar and the new value. Sometimes... that difference is just the addition of one or more tuples to the existing set; sometimes it is just changes to some of the attribute values of some of the existing tuples; and sometimes it is just the removal of some of the existing tuples. Shorthands for those three particular cases have been referred to as
INSERT
,UPDATE
andDELETE
respectively, since time immemorial -- in other words, even before the advent of relational databases, though of course before that advent the targets of the updates were files, not relvars or SQL tables [p.165]虽然[关系]赋值在理论上足以用于更新目的,但通常使用表示目标relvar的当前值与新值之间的差异的简写更为方便。有时......差异只是在现有集合中添加了一个或多个元组;有时它只是改变了一些现有元组的某些属性值;有时它只是删除了一些现有的元组。这三个特殊情况的缩写分别被称为INSERT,UPDATE和DELETE,从远古时代开始 - 换句话说,甚至在关系数据库出现之前,虽然当然在出现之前,更新的目标是文件,而不是relvars或SQL表[p.165]
#2
5
When in doubt, call it a "statement."
如有疑问,请将其称为“声明”。
#3
0
Sometimes anything other than select is considered to be DML - Data Manipulation Language. However this is not a hard and fast distinction. That is just as often select is included within DML.
有时除了select之外的任何东西都被认为是DML - 数据操作语言。然而,这不是一个硬性和快速的区别。这就像DML中经常包含select一样。
#1
7
The generic term for a INSERT
, UPDATE
, DELETE
and MERGE
is an "update" (even though it is potentially confusing -- and not ideal -- that UPDATE
is merely a subset of "update"). An alternative term is "relational assignment".
INSERT,UPDATE,DELETE和MERGE的通用术语是“更新”(即使它可能令人困惑 - 并且不理想 - UPDATE仅仅是“更新”的子集)。另一个术语是“关系分配”。
The generic term for SELECT
, INSERT
, UPDATE
, DELETE
, MERGE
(and anything else terminated by a semicolon) is known as a "statement".
SELECT,INSERT,UPDATE,DELETE,MERGE(以及以分号结尾的任何其他内容)的通用术语称为“语句”。
Strictly speaking, a "query" is a SELECT
statement that returns a resultset (which would for example preclude SELECT..INTO..FROM
statements). However, using the term "query" to refer to an update, while informal, is unfortunately very common. For example, although "update query" is an oxymoron, when I do a Google search for this site using that exact term (site:*.com "update query"
) I get 17,300 hits!
严格地说,“查询”是一个返回结果集的SELECT语句(例如,它会排除SELECT..INTO..FROM语句)。但是,使用术语“查询”来指代更新,虽然是非正式的,但遗憾的是很常见。例如,虽然“更新查询”是矛盾的,但当我使用该确切术语(site:*.com“更新查询”)搜索此网站时,我会获得17,300次点击!
UPDATE (pun indended :)
更新(双关语:)
@David Marx: I disagree with your claim that it's appropriate to refer to INSERT/DELETE/MERGE as an 'update.' That would be extremely confusing. Only UPDATE is an update.
@David Marx:我不同意你的说法,即将INSERT / DELETE / MERGE称为'更新'是合适的。那将是非常混乱的。只有UPDATE才是更新。
I agreed in my original answer that the situation is potentially confusing. We are fortunate on * to be able to format answers and comments so that a keyword UPDATE
can be differentiated from a logical update; writing keywords in upper case (as required by Full Standard SQL-92 :) also helps.
我在原来的回答中同意这种情况可能令人困惑。我们很幸运能够在*上格式化答案和注释,以便可以将关键字UPDATE与逻辑更新区分开来;以大写形式编写关键字(按照完整标准SQL-92 :)的要求也有帮助。
However, from reading the general database and computing science literature, I can tell you that 'update' is indeed the correct collective term. I below provide a citation for this:
但是,通过阅读通用数据库和计算科学文献,我可以告诉你“更新”确实是正确的集体术语。我在下面提供了一个引用:
"An Introduction to Relational Database Theory" (2010), Hugh Darwen [available as a free pdf download -- Google it):
“关系数据库理论简介”(2010),Hugh Darwen [免费pdf下载 - Google it):
The different update operators expected in a relational DBMS are usually called
INSERT
,DELETE
andUPDATE
, and those are the names used in Tutorial D (also in SQL) [p.28]关系DBMS中预期的不同更新运算符通常称为INSERT,DELETE和UPDATE,这些是教程D中使用的名称(也在SQL中)[p.28]
It is regrettable that the keyword
UPDATE
has become so widely accepted as the name of just one particular operator for updating databases. Please don't shoot the messenger! [p.168]令人遗憾的是,关键字UPDATE已被广泛接受为仅用于更新数据库的一个特定运算符的名称。请不要拍信使! [第168页]
although [relational] assignment is theoretically sufficient for updating purposes, it is usually more convenient to use a shorthand expressing the difference between the current value of the target relvar and the new value. Sometimes... that difference is just the addition of one or more tuples to the existing set; sometimes it is just changes to some of the attribute values of some of the existing tuples; and sometimes it is just the removal of some of the existing tuples. Shorthands for those three particular cases have been referred to as
INSERT
,UPDATE
andDELETE
respectively, since time immemorial -- in other words, even before the advent of relational databases, though of course before that advent the targets of the updates were files, not relvars or SQL tables [p.165]虽然[关系]赋值在理论上足以用于更新目的,但通常使用表示目标relvar的当前值与新值之间的差异的简写更为方便。有时......差异只是在现有集合中添加了一个或多个元组;有时它只是改变了一些现有元组的某些属性值;有时它只是删除了一些现有的元组。这三个特殊情况的缩写分别被称为INSERT,UPDATE和DELETE,从远古时代开始 - 换句话说,甚至在关系数据库出现之前,虽然当然在出现之前,更新的目标是文件,而不是relvars或SQL表[p.165]
#2
5
When in doubt, call it a "statement."
如有疑问,请将其称为“声明”。
#3
0
Sometimes anything other than select is considered to be DML - Data Manipulation Language. However this is not a hard and fast distinction. That is just as often select is included within DML.
有时除了select之外的任何东西都被认为是DML - 数据操作语言。然而,这不是一个硬性和快速的区别。这就像DML中经常包含select一样。