How to Find Duplicate Records in SQL | GROUP BY + HAVING Explained

Опубликовано: 15 Сентябрь 2026
на канале: W3 Raja
11
1

In this video, I explain how to find duplicate employees in a SQL table using simple and practical queries.
We will cover:

Selecting all records from the employees table
Using GROUP BY to count occurrences of each name
Filtering only the duplicate records with HAVING COUNT(*) greater than 1
Finding duplicates based on both name and email

Queries used in this video:

-- View all employees
SELECT * FROM employees;

-- Count occurrences of each name
SELECT name, COUNT(*) AS count_value
FROM employees
GROUP BY name;

-- Find only duplicate names
SELECT name, COUNT(*) AS count_value
FROM employees
GROUP BY name
HAVING count_value greater_than 1;

-- Find duplicates based on name + email
SELECT name, email, COUNT(*) AS count_value
FROM employees
GROUP BY name, email
HAVING count_value greater_than 1;

This is a practical screen recording focused on real SQL concepts that every beginner and intermediate learner should know.

If you found this helpful, please like, comment, and subscribe for more SQL tutorials!

#SQL #SQLTutorial #FindDuplicates #GROUPBY #HAVING #SQLQueries #Database #LearnSQL