题解 | #大小写混乱时的筛选统计#

大小写混乱时的筛选统计

https://www.nowcoder.com/practice/81cb12931a604811ae69d332515c7734

with cte_get_tag as (
    select tag,count(start_time) as num_start
    from examination_info
    right join exam_record using(exam_id)
    group by tag
	# 先计算每个试卷的数量
)


select a.tag,b.num_start
from cte_get_tag a
join cte_get_tag b
on upper(a.tag) = b.tag and a.tag !=b.tag and a.num_start < 3
# 用小写字母的名字内连接对应大写字母,且数量小于3。内连接会自动删除其他不符合条件的行

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务