SQL PRACTICE: SQL SERVER - Find Duplicate Rows
Q8. How to find duplicate rows using SQL?
N.B: I am using the following:
Database -> MSSQL
SQL Dialect -> T-SQL
I have a table given below:
Table1. Employees Table
To find duplicate records from the table, we are going to use to use aggregate functions such as count and having.
select
EmpId,
count(*) as Count
from employees
group by EmpId
having count(*) >=2;
Comments
Post a Comment