How do i find the largest value in a column in postgres sql?

diesel picture diesel · Feb 6, 2011 · Viewed 66.4k times · Source

For example:

name | weight
jon    100    
jane   120    
joe    130

How do I only return the name of the person with the largest weight?

Answer

raveren picture raveren · Dec 5, 2012
SELECT name FROM tbl ORDER BY weight DESC LIMIT 1

Much more performant than the other answer and results in one row only.