The DISTINCT keyword can be used to return only distinct (different) values.
Example :- In a table, a column may contain many duplicate values; and sometimes you only want to list the different (distinct) values.
Syntax :-
Example :-We have following table named is tblStudentRecord and it has five columns Name, Rollno, Branch, Email and Address, as shown in below:-
But, we want to select only two columns Name and Address from tblStudentRecordtable. This type of output get by DISTINCT statement as shown in below.
Example :- In a table, a column may contain many duplicate values; and sometimes you only want to list the different (distinct) values.
Syntax :-
SELECT DISTINCT column_name,column_name FROM table_name
Example :-We have following table named is tblStudentRecord and it has five columns Name, Rollno, Branch, Email and Address, as shown in below:-
But, we want to select only two columns Name and Address from tblStudentRecordtable. This type of output get by DISTINCT statement as shown in below.
SELECT DISTINCT Name,Address from tblStudentRecord
No comments:
Post a Comment