You are currently viewing How To Select Distinct Records in SQL Server

How To Select Distinct Records in SQL Server

How To Select Distinct Records in SQL Server

A distinct keyword is used to retrieve distinct records from a table. Distinct keyword is used with the select statement and eliminate the duplicate records and retrieve the unique records. There is a possibility of duplicate records in your database table, while you need to fetch only unique records the distinct keyword is used.

DISTINCT keyword can also be used with aggregate functions like SUM, AVG, MIN, MAX etc.

SQL SELECT DISTINCT Demo

For this demo, first we create a table tblEmployee and insert some records.

Let’s insert some records.

Let’s insert some duplicate records.

Now, Select Distinct records from the table.

SELECT DISTINCT EmpFirstName FROM tblEmployee

Recommended Readings

Buy Best Stationery Products in Pakistan

Piano Ballpoint Pen

Piano Ballpoint Pen

ORO Trimetal Pencil

ORO Trimetal

Dollar Clipper Pen

UHU 10×7 ml Pack of 10 PCs

UHU 10×7 ml Pack of 10 PCs

Glue Stick 8g Pack Of 12 PCs

Glue Stick 8g

Color Pencils Box of 12 PCs

Deer Multi Color Pencils