SELECT TOP

SQL SELECT TOP Keyword

The SELECT TOP command is used in SQL Server to return only the top N rows in a result set.

Note:

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

SQL SELECT TOP Syntax

SQL

SQL SELECT TOP Example

SQL

Note: This code does not work in TechKubo playground. SQLite does not support SELECT TOP. Use LIMIT instead.

SQL SELECT TOP Equivalent Using LIMIT Example

SQL

SQL SELECT TOP Equivalent Using ROWNUM (Oracle Only)

SQL

Note: This code does not work in TechKubo playground. SQLite does not support ROWNUM.

SQL SELECT TOP Labs

Tutorials dojo strip