Friday, 3 August 2012

SQL TOP Clause

SQL TOP Clause




The TOP clause is used to specify the number of records to return.The TOP clause is very useful on large tables.Return a large number of records effect the performance.
All database system like sql server,oracle,mysql support TOP Clause.


  1. In SQl Server:



select top number(1,2......)percent(in number) col_name(s) from table name

as for example:

select top 10 * from table name

  • above syntax shows top ten records from particular table.


select top 50 percent * from table name


  • above syntax shows top 50 percent data of that table

2.  In Oracle

select * from table name where rownum<=number

as for example



select * from table name where rownum<=5
  • above syntax shows only top 5 records from given table





You can ask any question regarding ASp.net,Sql Server, Oracle

No comments:

Post a Comment