select device_id
from user_profile left join question_practice_detail using(device_id)
group by device_id 
having group_concat(distinct university)='北京大学' or count(*)>2
order by device_id desc