TypechoJoeTheme

IT技术分享

统计

SQL SERVER 数据查询

2015-05-19
/
0 评论
/
770 阅读
/
正在检测是否收录...
05/19

一、语法格式

select [all|distinct] column1 [as alias1],column2 [as alias2] ...

[into new_Table]

from table_source

[where search_conditions]

[group by group_by_expression]

[having search_conditions]

[order by order_expression [asc|desc]]   --如order by column1 asc,column2 desc ...

二、分组

select avg(column1),[column2],[column3]...

from table_source

[where search_conditions]

group by [rollup|cube] column2 [,column3]... --rollup,cube表示对平均值再求平均值

having func_conditions  --对聚合的结果再进行筛选

三、函数

select [max|min|avg|sum|top num](column1)

from table_source

[where search_conditions]
朗读
赞 · 0
版权属于:

IT技术分享

本文链接:

https://idunso.com/archives/151/(转载时请注明本文出处及文章链接)