TechnoLearnAcademy

TECHNOLEARN

SQL SELECT TOP Clause

The SELECT TOP clause is used to specify the number of records to return.

Syntax:      

                SELECT TOP number| percent column1 , column2 , column3  from tablename ; 
Note: In the syntax, the number denotes the number of rows shown from the top in the output.
Let’s understand the select top clause with an example. For demonstration purposes, we will be using the table emp.
         Table Emp

Example:

   Objective: In this example, we will retrieve the top ten records from the Emp table. 
                      SELECT TOP 10  * FROM Tbl_Emp;
    Output:

Example:

   Objective: In this example, we will extract the top 10 percent of records from the Emp table.
                      SELECT TOP 10 percent * FROM Tbl_Emp;
    Output:
Scroll to Top