SELECT TOP, LIMIT AND ROWNUM Keywords

LIMIT, SELECT TOP, and ROWNUM are all keywords used in database management systems to limit the number of records returned by a query.

LIMIT:

LIMIT is a keyword used in MySQL and PostgreSQL databases to limit the number of records returned by a query. It specifies the maximum number of records to return from the result set. For example, SELECT * FROM table_name LIMIT 10 will return the first 10 records from the table. 

SELECT TOP:

SELECT TOP is a keyword used in Microsoft SQL Server to limit the number of records returned by a query. It specifies the maximum number of records to return from the result set. For example, SELECT TOP 10 * FROM table_name will return the first 10 records from the table.

ROWNUM:

ROWNUM is a keyword used in Oracle databases to limit the number of records returned by a query. It assigns a unique row number to each row in the result set, which can then be used to limit the number of records returned. For example, SELECT * FROM table_name WHERE ROWNUM <= 10 will return the first 10 records from the table.

 

All of these keywords serve a similar purpose, which is to limit the number of records returned by a query. However, they have slightly different syntaxes and are specific to different database management systems.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories