Instagram
youtube
Facebook
Twitter

Find Duplicate Products by Name

Find Duplicate Products by Name

Producrs Table:


Explanation:

  • GROUP BY ProductName:
    Groups products by their name.

  • COUNT(*):
    Counts how many times each product name appears.

  • HAVING COUNT(*) > 1:
    Filters only those names that appear more than once — i.e., duplicates.

  • SELECT ProductName, COUNT(*):
    Shows the name and how many times it’s repeated.

    SQL Query:

    SELECT 
        ProductName, 
        COUNT(*) AS DuplicateCount
    FROM 
        Products
    GROUP BY 
        ProductName
    HAVING 
        COUNT(*) > 1;
    


    Output: