MySQL Select Top Syntax

The "select top" syntax is a syntax used by certain databases to limit the returned rows to the first N rows of a query.

MySQL does have a way to select the top N rows from an SQL query, but the syntax does not use the top keyword. Instead, MySQL uses a limit clause.

For example, databases that support the top syntax may use the following syntax to return the first 100 rows from a query:

select top 100 * from sales

The MySQL equivalent of the above syntax would be the following:

select * from sales limit 100

In addition to giving the ability to return the top N rows from a query, the MySQL limit syntax also supports returning rows based on an offset or a range. The following link has more examples of how to use the MySQL limit syntax: MySQL Limit Syntax