All for Joomla All for Webmasters

SQL SELECT TOP

The SQL SELECT TOP Statement is used to select top data from a table. The top clause specifies that how many rows are returned.

Let’s see an example. If a table has a large number of data, select top statement determines that how many rows will be retrieved from the given table.

There is an example of employee table:

EMP_ID NAME SIR_NAME USER_NAME
1 RAHUL OJHA ra@jha
2 ANU SHARMA anusha1
3 RAVI SINGHAL ravin

Let’s see the syntax for the select top statement.

  1. SELECT COUNT (expression)

Let’s see the example of sql select top statement.

  1. SELECT TOP 2 * FROM employee

It will return the following table:

EMP_ID NAME SIR_NAME USER_NAME
1 RAHUL OJHA ra@jha
2 ANU SHARMA anusha1
PinIt
submit to reddit

Leave a Reply

Top