TOP in SQL Server

TOP is a command generally used along with SELECT Command.

TOP command is used to restrict or limit the number of rows in the result set.

Syntax for TOP Clause will be as follows:

SELECT TOP <Number or Percent>  < Required columns> FROM <Table Name>

Using TOP Clause , user can select only required number of rows or required Percentage of data from the entire table or set of tables.

Examples :

MYORDERS table contains 108 records in the table.

  • SELECT TOP 10 * FROM MYORDERS
Above statement retrieves only 10 records from the MYORDERS table.
























  • SELECT TOP (10)PERCENT * FROM MYORDERS
Above statement retrieves only 10% of the records from the MYORDERS table. That is (108)/10= 10.8 ~ 11

Fraction values are rounded up to next integer values.

So, Above query will return 11 row.


This entry was posted in . Bookmark the permalink.

Leave a reply