SQL SEVER 2000 的语句查询格式

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL SEVER 2000 的语句查询格式相关的知识,希望对你有一定的参考价值。

我想要份全面的 sql 2000 语句查询,有详细解释的。谢谢!帮帮忙!

从数据库中检索行,并允许从一个或多个表中选择一个或多个行或列。虽然 SELECT 语句的完整语法较复杂,但其主要子句可归纳如下:

[ WITH <common_table_expression>]

SELECT select_list [ INTO new_table ]

[ FROM table_source ] [ WHERE search_condition ]

[ GROUP BY group_by_expression]

[ HAVING search_condition]

[ ORDER BY order_expression [ ASC | DESC ] ]

可在查询之间使用 UNION、EXCEPT 和 INTERSECT 运算符,以便将各个查询的结果合并或比较到一个结果集中。

Transact-SQL 语法约定

语法

SELECT statement ::= [WITH <common_table_expression> [,...n]]
<query_expression>
[ ORDER BY order_by_expression | column_position [ ASC | DESC ]
[ ,...n ] ]
[ COMPUTE
AVG | COUNT | MAX | MIN | SUM ( expression ) [ ,...n ]
[ BY expression [ ,...n ] ]
]
[ <FOR Clause>]
[ OPTION ( <query_hint> [ ,...n ] ) ]
<query expression> ::=
<query specification> | ( <query expression> )
[ UNION [ ALL ] | EXCEPT | INTERSECT
<query specification> | ( <query expression> ) [...n ] ]
<query specification> ::=
SELECT [ ALL | DISTINCT ]
[TOP expression [PERCENT] [ WITH TIES ] ]
< select_list >
[ INTO new_table ]
[ FROM <table_source> [ ,...n ] ]
[ WHERE <search_condition> ]
[ GROUP BY [ ALL ] group_by_expression [ ,...n ]
[ WITH CUBE | ROLLUP ]
]
[ HAVING < search_condition > ]

备注
由于 SELECT 语句的复杂性,下面按子句说明详细的语法元素和参数:

WITH common_table_expression
UNION

SELECT 子句
EXCEPT 和 INTERSECT

INTO 子句
ORDER BY

FROM
COMPUTE

WHERE
FOR 子句

GROUP BY
OPTION 子句

HAVING
参考技术A http://www.4oa.com/article/html/6/36/517/2005/19596.html

这个不错。
若下不了请按该名称搜索一下。

以上是关于SQL SEVER 2000 的语句查询格式的主要内容,如果未能解决你的问题,请参考以下文章

sql sever 查询语句

SQL Sever将SQL Sever中的一个数据表的数据导出为insert语句

MySQL中为啥不能在select语句中使用into将查询结果存入新表,但是SQL sever可以

SQL SEVER数据库重建索引的方法

sql语句查询结果想打印出来,格式能不能调整啊?怎么弄啊

如何把TXT文件中的数据批量导入SQL sever 2000中?