To find duplicate values in a table first we create one Employee table.
In that table there are four column id, name, designation and department.
here in select query first we grouping the designation column data from group by function and then use having function to check count is greater than one now print the duplicate designation data and also number of times.
select * from Employee;
ID |
NAME |
DESIGNATION |
DEPARTMENT |
1 |
Mike |
Software Developer |
Software Development |
2 |
David |
Team Lead |
Software Development |
3 |
Peter |
Manager |
Human Resources |
4 |
Andrew |
VP |
Human Resources |
5 |
Jane |
VP |
Software Development |
select designation,count(designation) from Employee group by(designation) having count(designation)>1;
DESIGNATION |
COUNT(DESIGNATION) |
VP |
2 |