SQL distinct is an inbuilt statement that is used for removing duplicate records from a column at the time of displaying the resulting sets from any table that is present in a database. If you want to remove duplicate items from the final result set then SQL Distinct is the answer to your problem. It filters out duplicate items and returns unique values from the table.

The distinct keyword is used with the select statement for fetching unique values from a table. There also exists some situation where there are multiple duplicate records. So, it makes more sense in retrieving unique values rather than retrieving duplicate records.

SQL Distinct Example

SQL  Select DISTINCT statement is used to return the distinct (different) values.

Inside a  table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.

#Syntax

Select distinct column1, column2, …., column n 
from table_name 
where[condition];

#sql #sql distinct

SQL Distinct Keyword Example | Distinct Statement in SQL
1.60 GEEK