ROWNUM

SQL ROWNUM Keyword

The ROWNUM keyword is used in Oracle databases to limit the number of rows returned by a query. It allows you to filter and return a specific number of rows from a result set.

Note:

  • SQL Server uses SELECT TOP
  • MySQL and SQLite use LIMIT
  • Oracle uses ROWNUM

Tutorials dojo strip

SQL ROWNUM Syntax

SQL

SQL ROWNUM Example

This query selects the first 3 rows from the Patients table.

SQL

Note: This code does not work in the TechKubo playground. SQLite (and TechKubo) does not support ROWNUM. To achieve the same result in SQLite, use LIMIT instead.

SQL LIMIT Equivalent Example

SQL

SQL ROWNUM Labs

Tutorials dojo strip