This SQL statement returns the top value in where in want to retrieved.
This is used when there is a large number of data is stored in database table then fetching all data is taking more time then that case we use ‘Select Top’ command to find the specific data from table.
Syntax :
SELECT TOP Number * | PERCENT column_name(s)
FROM table_name WHERE condition;
Example : Lets have a table 'Customer'
The following statement returns top 4 row data from table.
select top 4 * from Customer;
The following statement returns the Top 40 % row data from 'Customer' table.
select top 40 percent * from Customer;
The following statement select top 2 row from table 'Customer' where city = New York.
select top 2 * from Customer where city='New York';