.png)
.
SELECT DISTINCT In SQL
Distinct means different, In Sql distinct (different) query is used to avoid the duplicate value. A table may contain duplicate value if you wants only distinct value 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 Above Example It Will Select all the Distinct value from studentname column in the student table.
SELECT COUNT (DISTINCT StudentName) FROM Student;
0 Comments