distinct statement SQL

distinct :- This statement is used with select clause, by which we can represent different values of any column present in table. it means if any column is having duplicate value in table then it will be displayed once only.

sells table -
Order ID
Order price
Quantity
Cust_name
1
100
2
Aayush
2
65
4
Tarun
3
287
1
Mayuri
4
1050
3
Kavita
5
3000
4
Himanshu
6
425
7
Chetan
7
210
2
Naved
8
777
NULL
Simran
9
115
9
NULL
10
4000
8
Ravi

syntax:- select distinct column_name from table_name where predicate;

example :- select distinct quantity from sells ;

o/p :- 

Quantity
2
7
9
8

No comments:

Post a Comment

Nested SQL Query or SQL Sub Query in hindi in english

if a SQL query is used inside another SQL query then this type of SQL query is called sub-query.  यदि किसी SQL क्वेरी का उपयोग, किसी अन्य SQ...