USING TOP CLAUSE

Wherever we have large tables with thousands of records we can use SELECT TOP Clause.

It limits the number of records in the query result set.

SYNTAX

55.png

Where,

  • SELECT TOP                         : keyword used to fetch limited records in a table. (3 records in this case)

  • Table_name                         : The name of the table from where you want to fetch the data

EXAMPLE

Let’s query PersonalInfo table in our Demo Database to fetch only top 2 records.

56.png
57.png
 

Figure 18.1. SELECT * FROM PersonalInfo

 

Figure 18.2 Select Top 2 * from table_name;

PRACTICE YOURSELF 

58.png