As we learn before, SQL SELECT statement will allow us to call out all the data from particular table. What if we want to select distinct elements?
In SQL, DISTINCT keyword is used to return only distinct (different) values.All we need to do is add the DISTINCT after SELECT.

The SQL Syntax will look like this:

SELECT DISTINCT [COLUMN NAME] FROM [TABLE NAME]

The DISTINCT clause allows you to remove duplicates from the result set.


EXAMPLE :

Let�s say, we want to know departments from GameScores for people who participate.

Table GameScores

PlayerNameDepartmentScores
JasonIT3000
IreneIT1500
JaneMarketing1000
DavidMarketing2500
PaulHR2000
JamesHR2000

SQL statement :

SELECT DISTINCT Department FROM GameScores

This SQL statement would return all unique Department from the GameScores table

Result:

Department
HR
IT
Marketing