Get the number of duplicate names and their frequency

Question

Table – Employee
Name

Nitin
Amit
Gaurav
Nitin
Amit

Output
Nitin – 2
Amit – 2
Gaurav – 1

in progress 1
TheDataMonk 55 years 11 Answers 1842 views Grand Master 0

Answers ( 11 )

  1. Sorry it a private answer.

  2. 1) This will give you the duplicate count

    select Name, count(Name) from Employee
    Group by Name
    Having count(Name) > 1

    2) This will give you the output given in the question

    select Name, count(Name) from Employee
    Group by Name

  3. select Name as duplicate_name , count(1) as frequency
    from Employee
    GROUP BY Name

  4. — if you want only the duplicate names
    select name, count(name)
    from employees
    group by name having count(name) > 1

    –returning all names and their frequency
    select name, count(name) as frequency
    from employees
    group by name

  5. SELECT Name, count(Name) as Frequency FROM Employee GROUP BY Name;

  6. SELECT Name, count(Name) FROM table GROUP BY Name;

  7. SELECT name ,COUNT(*) AS frequency
    FROM names
    GROUP BY name

  8. According to the OUTPUT given:

    Select Name, COUNT(Name) as frequency
    from Employees
    GROUP BY Name;

  9. * Duplicate Names:
    SELECT name
    FROM Employees
    GROUP BY name
    HAVING count(name) > 1

    * Names with their frequency:
    SELECT name, Count(name) as frequency
    FROM Employees
    GROUP BY name

  10. select first_name, count(first_name) from actor
    group by first_name
    having count(first_name) > 1;

  11. SELECT name, COUNT(name) from Employee group by name
    having COUNT(name) >1

Leave an answer

Browse
Browse