select 
distinct
uid,
'activity1' activity
from 
exam_record
where 
score is not null
and uid not in (
    select uid
    from exam_record
    where score<85
)
union all
select 
distinct
uid,
'activity2' activity
from 
exam_record a,
examination_info b
where a.exam_id=b.exam_id
and b.difficulty='hard'
and a.score>80
and TIMESTAMPDIFF(SECOND,start_time,submit_time)<=1800
order by uid