
SELECT DISTINCT
We might have duplicate data entries in a table. To avoid viewing duplicating entries we can make use of DISTINCT keyword.
The SELECT DISTINCT statement is used to return only distinct values.
SYNTAX

Where,
-
SELECT DISTINCT : keyword used to fetch distinct records in a table.
-
Table_name : The name of the table from where you want to fetch the data
-
Column1Name, Column2Name : The name of the columns of the table which you want to uniquely fetch.
EXAMPLE
Let’s query PersonalInfo Table in our Demo Database and check for distinct records.


Figure 16.1. SELECT * FROM PersonalInfo
Figure 16.2 Selecting Distinct from PersonalInfo
PRACTICE YOURSELF

Want More SQL Deep Dives