Tuesday 7 April 2015

SQL Server TOP Keyword

TOP : SQL Server TOP clause is used to fetch a TOP N number or X percent records from a table.

Note: All the databases do not support TOP clause(SQL Server). For example MySQL supports LIMIT clause to fetch limited number of records and Oracle uses ROWNUM to fetch limited number of records.

Syntax:

SELECT TOP number|percent column_name(s) FROM table_name WHERE [condition]

Queries :

1. Write a Query to get only one/top 1 record from employee table.


Ans: Select Top 1 * from employee.

No comments:

Post a Comment