Decode Analytics

View Original

Select TOP

The SELECT TOP statement retrieves records from one or more tables or views and limits the number of records returned based on a fixed value or percentage.

SQL Select TOP syntax:

 SELECT TOP number/percentage

Column1

FROM Table_Name

WHERE condition;

Example:

Lets select the TOP 4 rows from the following table.

See this content in the original post

Results:

See this content in the original post


Lets select TOP 50 percent of data.

See this content in the original post

Results:

See this content in the original post

Use a where condition to further filter down withing the result set.

See this content in the original post


Results:

See this content in the original post

SQL Tutorial

See this content in the original post