以下面兩個案例介紹distinct、group by的底層原理。
【案例 1】去重計數案例
select count(1) from(
select age
from student
group by age
)b
【案例2】簡化的去重計數
select count(distinct age)
from student
以下面兩個案例介紹distinct、group by的底層原理。
【案例 1】去重計數案例
select count(1) from(
select age
from student
group by age
)b
【案例2】簡化的去重計數
select count(distinct age)
from student