Postgresql select row with minimum value by certain column? I've data like this

id  student  grade subject
-----------------------------
0   Amy      5     Art History
1   Amy      2     Ethics
2   Jhon     7     Calculus
3   Joe      4     Poetry
4   Joe      2     Cooking
5   Jhon     2     PE


Find out everyone's lowest scores

Results 
--------------
1   Amy      2     Ethics
5   Jhon     2     PE
4   Joe      2     Cooking


Tried Solution

SELECT *, min(grade)
FROM data
GROUP BY student


I get error must appear in the GROUP BY clause or be used in an aggregate...
If you're not worrying about ties, then use the PostgreSQL extension for DISTINCT ON

SELECT DISTINCT ON (id) id, student, grade, subject
FROM table
ORDER BY id, grade;