<-- Chapter 3: SQL Select
Chapter 4
SQL District
SQL District : District is a keyword which is used to fetch unique column values from database table OR we can simply say that ignores the column duplicate values. Syntax for district keyword is used below :-
SELECT DISTINCT columnname
FROM tablename;
Lets take an example, we have a database table "employees" below :-
employee_id |
name |
code |
designation |
salary |
101 |
ABC |
E-101 |
Engineer |
12000 |
102 |
DEF |
E-102 |
Doctor |
8000 |
103 |
GHI |
E-103 |
Software Developer |
8000 |
104 |
JKL |
E-104 |
CEO |
12000 |
105 |
MNO |
E-105 |
Software Developer |
100000 |
Now we will use district keyword here to get employee records with unique salary.
SELECT DISTINCT `salary`
FROM `employees`;
Now Run this Query, we will see the output below :-
We can see the unique salary i.e unique column values in the above Output.
Chapter 5: SQL Where -->
0 Comment(s)