In this tutorial we will learn how to use SQL Distinct keyword in SQL Server OR what is SQL Distinct Operator in SQL Server or how to select unique record in SQL Server with Example.
The SQL DISTINCT keyword is used with the SELECT statement to eliminate the duplicate records and return only unique records.
There may be a case when you have multiple duplicate records in a table. While getting such records, it will get only unique records instead of getting duplicate records.
The basic syntax of DISTINCT keyword to eliminate duplicate records is as follows:
DISTINCT column1, column2 FROM table_name
The Following SQL Statement selects all Records from Student Table.
select Name,Mobile,address1 from Student
The following SQL statements remove all duplicate students. Above highlighted duplicate rows show once.
select distinct Name,Mobile,address1 from Student
hope this will help you.