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。内连接会自动删除其他不符合条件的行