select device_id, gender, age, gpa from user_profile where university = '山东大学' union ALL select device_id, gender, age, gpa from user_profile where gender = 'male'
union 和 union all,将列相同的表合在一块,
union去重并排序,
union all直接将表合在一块,效率比union高。
select device_id, gender, age, gpa from user_profile where university = '山东大学' union ALL select device_id, gender, age, gpa from user_profile where gender = 'male'