---
title: "How to select unique records from a table in SQL Server Database?"  
description: "How to select unique records from a table in SQL Server Database?"  
author: "Ravi Vishwakarma"  
published: 2021-09-22  
updated: 2021-09-22  
canonical: https://www.mindstick.com/forum/156746/how-to-select-unique-records-from-a-table-in-sql-server-database  
category: "database"  
tags: ["database", "mysql", "sql server", "sql"]  
reading_time: 3 minutes  

---

# How to select unique records from a table in SQL Server Database?

How to [select unique records from a table](https://www.mindstick.com/interview/23511/how-to-select-unique-records-from-a-table) in SQL [Server Database](https://www.mindstick.com/forum/156824/what-is-normalization-in-sql-server-database)?

## Replies

### Reply by Ashutosh Kumar Verma

Select Unique data from table-

This SQL statement used to retrieve unique(different) values. Sometimes a database table contains many duplicated value and if we want to retrieve all duplicated values in single from then we can use this SQL statement. It returns all different values from table.

Syntax –

SELECT DISTINCT column1,column2,column3,…. FROM table_name ;

Example:

Lets tale a table 'Orders'.

The following SQL statement is select the Unique values from OrderName column in Orders table.

Select Multiple column unique value from Orders table.

The following SQL statement is lists the number of different Id from Orders table-

This statement will returns the number of different column values from database table.

\

### Reply by Ashutosh Kumar Verma

Select Unique data from table-

This SQL statement used to retrieve unique(different) values. Sometimes a database table contains many duplicated value and if we want to retrieve all duplicated values in single from then we can use this SQL statement. It returns all different values from table.

Syntax –

SELECT DISTINCT column1,column2,column3,…. FROM table_name ;

\

\

### Reply by Ashutosh Kumar Verma

[Select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) [Unique](https://www.mindstick.com/blog/12870/how-to-be-unique-in-business) data from table-

This SQL statement used to retrieve unique(different) values. Sometimes a database table contains many duplicated value and if we want to retrieve all duplicated values in single from then we can use this SQL statement. It returns all different values from table.

Syntax –

\

\

### Reply by Ashutosh Kumar Verma

[Select Unique](https://www.mindstick.com/forum/531/select-unique-record-from-table) data from table-\

This SQL statement used to retrieve unique(different) values. Sometimes a [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax) table contains many duplicated value and if we want to retrieve all duplicated values in single from then we can use this SQL statement. It returns all different values from table.

**Syntax** –

> select distinct column1,column2,column3,…. from table-name ;

**Example**:

Lets tale a table 'Orders'.

![How to select unique records from a table in SQL Server Database?](https://www.mindstick.com/mindstickforums/42e4dd25-6502-4589-a81b-53d63206eb41/images/44ba8a0b-e299-4a71-9e93-fb98cc662f2a.png)

The following SQL statement is select the Unique values from OrderName column in Orders table.

![How to select unique records from a table in SQL Server Database?](https://www.mindstick.com/mindstickforums/42e4dd25-6502-4589-a81b-53d63206eb41/images/6294e1b0-9763-4259-93da-58d7b1a0b64e.png)

Select Multiple column unique value from Orders table.

![How to select unique records from a table in SQL Server Database?](https://www.mindstick.com/mindstickforums/42e4dd25-6502-4589-a81b-53d63206eb41/images/5f243856-e880-4983-983f-1a8712d836e2.png)\

## The following SQL statement is lists the number of different Id from Orders table-

This statement will returns the number of different column values from database table.

![How to select unique records from a table in SQL Server Database?](https://www.mindstick.com/mindstickforums/42e4dd25-6502-4589-a81b-53d63206eb41/images/65477fe4-40e0-48ff-a990-bb68a8602fc9.png)

\


---

Original Source: https://www.mindstick.com/forum/156746/how-to-select-unique-records-from-a-table-in-sql-server-database

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
