问题描述
我仍然生活在这种歧义中:从概念上说,SQL中的语句和查询之间有什么区别?任何人都可以给他们每个人的定义?这将是有用的,例如,当选择变量名称在程序中的方式,将是清楚的每个人。
谢谢!
I still live in this ambiguity: conceptually what's the difference between a statement and a query in SQL? Can anybody give a definition for each of them? It would be useful, for example when choosing variables names inside programs in a way that will be clear for everybody.Thanks!
ADDITIONALLY:如何调用多个SQL语句,一个分号(;
)?谁已经回复可以编辑他的答案。非常感谢!
ADDITIONALLY: How can I call a chunk of SQL code made by more than one statement where statements are separated by a semicolon (;
)? Who already replied can edit his answer. Many thanks!
推荐答案
是数据库引擎识别为有效命令的任何文本。自 SQL-92
:
查询返回一个记录集(可能为空)。
A query is a statement that returns a recordset (possibly empty).
一系列 SQL
语句立即发送到服务器
A series of SQL
statements sent to the server at once is called a batch.
并非所有 SQL
引擎都需要批处理语句以分号分隔。 SQL Server
,例如,一般不基于上下文来断言语句。 CTE
以 WITH
开头的语句是一个值得注意的例外。
Not all SQL
engines required the statements in a batch to be semicolon delimited. SQL Server
, for instance, generally does not and breaks the statements based on context. CTE
statements starting with WITH
are a notable exception.
这篇关于SQL语句和查询之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!