selecting top n records from a table

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 377
TOP n Limits the rows returned in a query result set to a specified number of rows or percentage of rows

SELECT top 10 * FROM CITY ORDER BY CITY_NAME


Results the top 10 records based on City Name in ascending order...


SELECT top 10 * FROM CITY


Results the top 10 records from CITY table in an undefined order


SELECT top 10 PERCENT * FROM CITY

results ((TotalNumberOfRecords*10) / 100 ) number of records i.e. 42 records for total of 420 records, 12 records of 120 records....

Comments or Responses

Login to post response