SQL语句和查询之间的区别 [英] Difference between a statement and a query in SQL

查看:162
本文介绍了SQL语句和查询之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然生活在这种歧义中:从概念上说,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


SQL语句是一个字符串符合此国际标准中指定的格式和语法规则。

An SQL-statement is a string of characters that conforms to the format and syntax rules specified in this international standard.

查询返回一个记录集(可能为空)。

A query is a statement that returns a recordset (possibly empty).


如何调用一个SQL语句代码,分号(;)?谁已经回复可以编辑他的答案。非常感谢!

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 语句立即发送到服务器

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语句和查询之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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