Assume that you have a scenario where you need to retrieve the only the top 5 rows who has the maximum salary from the Employees table.
The column name is salary and the table name is Employees.
How to select Top 5 records from a table in MySQL?
To retrieve the Top 5 employees with maximum salary, order the records by descending order by salary and use the LIMIT keyword to retrieve the top 5 records as shown below.
SELECT salary FROM Employees ORDER BY salary DESC LIMIT 5