SQL TOP Clause

Friday, October 28, 2011

tags SQL

The TOP clause is used to specify the number of records to return, rather than returning the entire dataset. The TOP clause can be very useful on large tables, where you may only be interested in a subset of the records.

SQL Server Syntax

SELECT TOP number|percent column_name(s)
FROM table_name

SQL TOP Example

SELECT TOP 5 * FROM Customers

The result will be five rows of data from the Customers table.


The results will display 10% of data from the Customers table.

Other commands can be used in conjucntion with the TOP clause such as WHERE, ORDER BY to further manipulate the results.

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

SQL Cookbook Head First SQL: Your Brain on SQL A Learners Guide