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