简单的sql语句 数据与汇总。 高手多多指点。

源代码在线查看: 聚合函数.sql

软件大小: 11 K
上传用户: janeljh1
关键词: sql 数据 高手
下载地址: 免注册下载 普通下载 VIP

相关代码

				use northwind
				go
				
				select top 5 with ties orderid,productid,quantity from [order details]
				order by quantity desc
				go
				
				select sum(quantity) from [order details]
				go
				
				select * from [order details]
				go
				
				select count(*) from [order details]
				go
				
				select * from employees
				go
				
				select count(reportsto) from employees
				go
				--count(reportsto)将忽略null值
				
				select count(*) from employees
				go
				--count(*)将计算所以行数,不会忽略null值
				
				
				select 
				num=count(*),
				'avg salary'=avg(salary),
				'low salary'=min(salary),
				'avg age'=avg(age),
				'low age'=min(age)
				from employees
				go
				
				exec sp_help employees
				go
				
							

相关资源