MySQL, Software Development

Top n values without using a limit clause or its equivalent

I came across this exam question several times in the past about how to get some top n values without using the LIMIT clause or its equivalent in other RDBMS (e.g., FIRST n in Informix) but never really gave it serious thought until today. I would skip the item and press on.

To achieve this, use a subquery. The following SQL SELECT statement retrieves the top 10 highest values from table T1.


Sample data


Retrieved top 10 highest values

You Might Also Like