bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL SELECT TOP, LIMIT and ROWNUM Keywords

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind SQL SELECT TOP, LIMIT and ROWNUM Keywords?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ TOP 3 * FROM Customers;
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The following SQL statement selects the first three records from the "Customers" table (SQL SERVER):
The LIMIT , SELECT TOP or ROWNUM command is used to specify the number of records to return.
SELECT TOP, LIMIT and ROWNUM

SELECT TOP, LIMIT and ROWNUM

The LIMIT , SELECT TOP or ROWNUM command is used to specify the number of records to return.

Note

SQL Server uses SELECT TOP . MySQL uses LIMIT , and Oracle uses ROWNUM .

The following SQL statement selects the first three records from the "Customers" table (SQL SERVER):

Example

SELECT TOP 3 * FROM Customers;

The following SQL statement shows the equivalent example using the LIMIT clause (MySQL):

Example

 SELECT * FROM Customers
LIMIT 3;

The following SQL statement shows the equivalent example using ROWNUM (Oracle):

Example

SELECT * FROM Customers
WHERE ROWNUM <= 3;

Previous

SQL SELECT INTO Keyword

Next

SQL SET Keyword