SQL Server Articles, Tips, FAQs, Reviews, Whitepaper, News etc - MyTechMantra.com

SQL Server SELECT TOP Clause T-SQL Tutorial with Examples

Previous Page.. Begin Tutorial.. Next Page..

The SELECT TOP Clause is used to specify the percentage of rows or to specify the number of rows which needs to be retrieved from a given table.

This is Part 2 of 40 Part SQL Server T-SQL Tutorial. Click here to read it from the beginning….

SELECT TOP Syntax – SQL Server SELECT TOP Clause

Use <DatabaseName>
GO

SELECT TOP VALUE column1, column2, column3,.......
FROM schema.table
GO

SELECT TOP PERCENT Syntax – SQL Server SELECT TOP Clause

Use <DatabaseName>
GO

SELECT TOP VALUE PERCENT column1, column2, column3,.......
FROM schema.table
GO

How to SELECT TOP 10 Records from a table

To select top 10 records from a table execute the below query in SSMS.

Use AdventureWorks2016
GO

SELECT TOP 10
	  FirstName
	, LastName 
FROM Person.Person
	WHERE LastName = 'Williams'
GO
How to SELECT TOP 10 Records from a table

How to SELECT TOP 10 PERCENT Records from a table

To select top 10 percent records from a table execute the below query in SSMS.

Use AdventureWorks2016
GO

SELECT TOP 10 PERCENT
	  FirstName
	, LastName 
FROM Person.Person
	WHERE LastName = 'Williams'
GO
How to SELECT TOP 10 PERCENT Records from a table

Click Next Page button to continue reading the topics and click on the Previous Page button to revisit the previous topic.

Previous Page.. Begin Tutorial.. Next Page..

Related T-SQL Tutorials

Ashish Mehta

Ashish Mehta

Ashish Kumar Mehta is a database manager, trainer and technical author. He has more than a decade of IT experience in database administration, performance tuning, database development and technical training on Microsoft SQL Server from SQL Server 2000 to SQL Server 2014. Ashish has authored more than 325 technical articles on SQL Server across leading SQL Server technology portals. Over the last few years, he has also developed and delivered many successful projects in database infrastructure; data warehouse and business intelligence; database migration; and upgrade projects for companies such as Hewlett-Packard, Microsoft, Cognizant and Centrica PLC, UK. He holds an engineering degree in computer science and industry standard certifications from Microsoft including MCITP Database Administrator 2005/2008, MCDBA SQL Server 2000 and MCTS .NET Framework 2.0 Web Applications.

Add comment

Newsletter Signup! Join 15,000+ Professionals




Be Social! Like & Follow Us...

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Recent SQL Server Tips