HOW TO USE SELECT TOP CLAUSE IN SQL?

360 viewsSQLSQL
0

HOW TO USE SELECT TOP CLAUSE IN SQL?

Saraswat World Changed status to publish June 14, 2023
0
SELECT TOP in SQL
SELECT TOP in SQL
SELECT TOP

SELECT TOPย clause is used to specify the number of records to return from top of the table.

Syntax of TOP clause in SQL server โ€“

SELECT TOPย number|PERCENTย ColumnName1,โ€ฆ,ColumnNameN

FROMย <TableName>

WHERE<condition> ;

Exampleย ofย TOP clause in SQL server โ€“โ€“ย To select top 10 records of customers from city Berlin from customers table

SELECT TOPย 10ย ย *

FROMย Customers

WHEREย city=โ€˜Berlinโ€™;

Example-ย To select top 10%ย  records of customers from city Berlin from customers table

SELECT TOPย 10ย PERCENTย *

FROMย  Customers

WHEREย city=โ€˜Berlinโ€™;

Saraswat World Changed status to publish June 14, 2023
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

A Tribute to Dilip Kumar