Did you find this useful?
Socialize it today.


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.

SELECT TOP 10 PERCENT * FROM Customers

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.



Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.



Recommended Books & Training Resources

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