How to get lower value without aggregation function - SQL

Asked

Viewed 117 times

-1

Assuming a Student table that has as attributes(Id, Name, age). How I get the name of the underage student but without using aggregation function(MIN)?

2 answers

1


SELECT * FROM estudante WHERE NOT EXIST (SELECT * FROM Estudante est_aux WHERE estudante.idade > est_aux.idade);

0

You would do this in SQL Server:

SELECT TOP 1 * FROM estudante ORDER BY idade

Mysql would look like this:

SELECT * from estudante ORDER BY idade LIMIT 1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.