SQL Server Performance, DBA Best Practices & Enterprise Data Solutions | MyTechMantra
Home » SQL Server » SQL Server SELECT DISTINCT Clause T-SQL Tutorial with Examples

SQL Server SELECT DISTINCT Clause T-SQL Tutorial with Examples

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

The SELECT DISTINCT Statement is used to fetch distinct values in a specific column of a given table. This article gives you an overview of the SQL Server SELECT DISTINCT clause or SELECT DISTINCT SQL Clause.

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

SQL SELECT DISTINCT Statement

The SQL DISTINCT clause removes duplicates from the result set of a SELECT statement in SQL Server.

SELECT DISTINCT Syntax | SQL Server SELECT DISTINCT Statement

Use <DatabaseName>
GO

SELECT DISTINCT (column1)
	FROM schema.table
GO

Note: To fetch unique records from a SQL Server Database Table, one needs to use DISTINCT SQL Keyword.

SQL Server SELECT DISTINCT Statement: How to Query Distinct Records from a Table in SQL Server

SELECT DISTINCT Clause Example

Execute the below query will fetch all Distinct First Name’s (Column FirstName) from Person table.

Use AdventureWorks2016
GO

SELECT 
	  DISTINCT FirstName
FROM Person.Person
GO
SELECT DISTINCT Records from a Table in SQL Server


When you need to SELECT UNIQUE records from a SQL Server Database Table, one needs to use SELECT DISTINCT in the SQL Server.

SELECT DISTINCT Multiple Columns Example

Execute the below query will fetch all the records which are distinct for FirstName and LastName from Person’s table.

Use AdventureWorks2016
GO

SELECT 
	  DISTINCT FirstName 
		  , LastName
FROM Person.Person
GO
SELECT DISTINCT Multiple Columns Records from a Table in SQL Server

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..



Ashish Kumar Mehta

Ashish Kumar Mehta is a distinguished Database Architect, Manager, and Technical Author with over two decades of hands-on IT experience. A recognized expert in the SQL Server ecosystem, Ashish’s expertise spans the entire evolution of the platform—from SQL Server 2000 to the cutting-edge SQL Server 2025.

Throughout his career, Ashish has authored 500+ technical articles across leading technology portals, establishing himself as a global voice in Database Administration (DBA), performance tuning, and cloud-native database modernization. His deep technical mastery extends beyond on-premises environments into the cloud, with a specialized focus on Google Cloud (GCP), AWS, and PostgreSQL.

As a consultant and project lead, he has architected and delivered high-stakes database infrastructure, data warehousing, and global migration projects for industry giants, including Microsoft, Hewlett-Packard (HP), Cognizant, and Centrica PLC (UK) / British Gas.

Ashish holds a degree in Computer Science Engineering and maintains an elite tier of industry certifications, including MCITP (Database Administrator), MCDBA (SQL Server 2000), and MCTS. His unique "Mantra" approach to technical training and documentation continues to help thousands of DBAs worldwide navigate the complexities of modern database management.

Add comment

Follow us

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