Assuming a table Family
with Name
and Age
and records
Bob 55
Alice 40
Marky 12
If I run
Select Name,Min(Age) from Family
I get
Bob,12
I'm trying to ask for the fields from the single record with the lowest age yet I'm simply getting the first record Name and the Age from the record with the lowest value.
How can I use Min()
to make that request?
I understand that you want the entire row that has the smallest age. Assuming that you don't care about ties, you can just sort the rows by ascending age
and retain the first record only:
select *
from family
order by age
limit 1