SQL SELECT DISTINCT Statement

.
SQL- SELECT DISTINCT

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.

SQL- SELECT DISTINCT  Syntax
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;


SQL SELECT DISTINCT EXAMPLE-

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