Published Jan 30, 2023Updated May 15, 2024
Contribute to Docs

The SELECT TOP command returns a specified number of rows from the top of the result.


This command is used to select the initial rows from a table, limiting the result to a specified number, represented here by n:

SELECT TOP (n) column_name(s)
FROM table_name;

Where column_name(s) is a comma delimited list of columns from the table table_name.

The command can also be used with PERCENT to limit the result to the top n percent of rows:

SELECT TOP (n) PERCENT column_name(s)
FROM table_name;


The following query selects all columns from the top 5 rows of the books table:

FROM books;

The next query selects the top 25% of rows from the movies table, under just the movie_titles column:

SELECT TOP (25) PERCENT movie_titles
FROM movies;

All contributors

Looking to contribute?

Learn SQL on Codecademy