Software Testing

k2G9Eo9
RdZQRt6

Popular Posts

DISTINCT


The SQL DISTINCT keyword is used in conjunction with SELECT statement to eliminate all the duplicate records and fetching only unique records.
There may be a situation when you have multiple duplicate records in a table. While fetching such records, it makes more sense to fetch only unique records instead of fetching duplicate records.
The basic syntax is as follows:
SELECT DISTINCT Column_Name(s) FROM Table_Name WHERE Conditions
Syntax For SQL:
SELECT DISTINCTDept_id FROM Employee
Employee
Emp_idNameSurnameSalaryDept_id
1RajeshKhanna450002
2SnehaGupta550004
3SandeepNehte950001
4KirtiPatil250003
5NileshJadhav450003
6DipeshDas350005
7KailashRane620001
8KavitaDeshpande480003
9SanjayDatt500003
10ShrutiHasan780001

After Execute: 
Dept_id
2
4
1
3
5

No comments:

Post a Comment

BESbswy