.
SELECT DISTINCT In SQL
Distinct means different, In Sql, a distinct (different) query is used to avoid duplicate values. A table may contain duplicate values if you want only distinct values then use the DISTINCT Statement.
Syntax of SELECT DISTINCT
The basic syntax for the SELECT DISTINCT is as follows
SELECT DISTINCT Columnname FROM TableName;
Note: SQL SELECT DISTINCT can be used with COUNT.
SELECT COUNT (DISTINCT Columnname) FROM TableName;
Example of SELECT DISTINCT
SELECT DISTINCT StudentName FROM Student ;
In the Above Example, It Will Select all the Distinct values from studentname column in the student table.
SELECT COUNT (DISTINCT StudentName) FROM Student;
0 Comments