SQL26 calculates the number of users over and under the age of 25 (CASE WHEN used)

 correct answer:

select case 
        when age <25 OR age is NULL then "25岁以下" 
        when age >=25 then "25岁及以上"
        end age_cut,count(*) number 
from user_profile
group by age_cut

Guess you like

Origin blog.csdn.net/weixin_45813351/article/details/121768372