Italian Trulli

SQL SELECT DISTINCT Statement

Test Tribe
.
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;

In Above Example It Will display the count of all student .
Result- 6

Hope !!! The above tutorial of SELECT DISTINCT helpful for you..
Team
QA acharya

Tags: Sql distinct statement , sql select distinct count , sql distinct query .
Sql distinct statement

Post a Comment

0 Comments