If you are using SQL Server, then
SELECT TOP 1 name, height FROM people ORDER BY height DESC
SQL Server does not support the LIMIT
method, so here you need to use TOP
So if you are using MySQL:
SELECT name, height FROM people ORDER BY height DESC LIMIT 1
OR
If you are concerned about more than 1 person with the highest height, you can use the subquery:
SELECT name, height FROM people WHERE height = (SELECT TOP 1 height FROM people ORDER BY height DESC) ORDER BY name
And, of course, the same example with MySQL:
SELECT name, height FROM people WHERE height = (SELECT height FROM people ORDER BY height DESC LIMIT 1) ORDER BY name
source share