使用规范时 默认的是all
distinct
count
select count (
sum
select
分组
select
过滤聚合函数(having)
要注意的是
课后练习
select * from nobel
-- 1获奖总人数
select count (distinct winner) from nobel
-- 2 诺贝尔 物理奖的获奖总次数
select count(subject)from nobel where subject='Physics'
-- 3 显示每个奖项的获奖总次数
select subject,count(subject)from nobel group by subject
-- 4显示每个奖项第一次获得的年份
select min(yr) 年份,subject 奖项 from nobel group by subject
-- 5 显示每个奖项在2000年来获得的人数
select subject 奖项,yr 年份 from nobel where yr=2000 group by subject ,yr
-- 6 显示每个奖项不同获奖者的人数
select subject 奖项,count (distinct winner)from nobel group by subject
-- 7
select subject 奖项,count (distinct yr)from nobel group by subject
-- 8 显示当年有三个Physic的年份
select subject 奖项,yr 年份 from nobel where
-- 9 得奖大于1的winner
select winner 获奖者 from nobel group by winner having count(subject)>1
--10 得到多个奖项的winner
select winner 获奖者 from nobel group by winner having count(distinct subject)>1
--11