select *
from
    (select
        uid,
        'activity1' as activity
    from 
        exam_record
    where 
        year(start_time) = '2021'
    group by 
        uid
    having min(score) >= 85)  a

union all

select *
from
    (select
        er.uid,
        'activity2' as activity
    from
        examination_info ei 
    inner join
        exam_record er on ei.exam_id = er.exam_id
    where 
        timestampdiff(minute,er.start_time,er.submit_time) < ei.duration /2
        and ei.difficulty = 'hard'
        and er.score >= 80
        and year(er.start_time) = '2021') b

order by 
    uid