select
    device_id
    ,university
    ,gpa
from 
(
    select 
    *
    ,row_number() over (partition by university order by gpa) as r
    from user_profile
) as a
where r = 1
order by university asc