select u1.device_id,
u2.university,
u2.gpa
from user_profile as u1
right join( 
select
university,
min(gpa) as gpa
from user_profile
group by
university
order by university) as u2
on u1.university = u2.university
and u1.gpa = u2.gpa