Unique and Duplicate Data Identify in a table Archives - Tech Insights https://reactconf.org/category/unique-and-duplicate-data-identify-in-a-table/ Unveiling Tomorrow's Tech Today, Where Innovation Meets Insight Fri, 03 Aug 2012 10:54:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://i0.wp.com/reactconf.org/wp-content/uploads/2023/11/cropped-reactconf.png?fit=32%2C32&ssl=1 Unique and Duplicate Data Identify in a table Archives - Tech Insights https://reactconf.org/category/unique-and-duplicate-data-identify-in-a-table/ 32 32 230003556 How to Find the Unique and Duplicate Data in a Table https://reactconf.org/how-to-find-unique-and-duplicate-data_8985/ https://reactconf.org/how-to-find-unique-and-duplicate-data_8985/#respond Fri, 03 Aug 2012 10:54:00 +0000 http://www.sqlneed.com/2012/08/03/how-to-find-the-unique-and-duplicate-data-in-a-table/ How to Find out Unique and Duplicate Data in a  Table If you want to check the data in a table is unique or duplicate. In Oracle and Ms SQL …

The post How to Find the Unique and Duplicate Data in a Table appeared first on Tech Insights.

]]>
How to Find out Unique and Duplicate Data in a  Table
If you want to check the data in a table is unique or duplicate.
In Oracle and Ms SQL Server the standard Having clause for SELECT Statement with     built in count function which identify the unique data or duplicate data in a table.

SELECT * From EMP

Idx
 FirstName
LastName
Salary
1
Frank
Xylo
5000
2
Smith
Fay
10000
3
Smith
Fay
15000
4
John
Lay
12000
5
John
Fay
14000
6
Ebrahim
John
9000
7
Frank
Xylo
11000
8
Frank
Xylo
7000
This query finds the unique data in a table
SELECT Lastname, count(*)
From EMP
Where lastname = ‘John’
Group By Lastname
Having count(*) = 1;
LasteName
Count(*)
John
1
This query finds the duplicate data in a table

SELECT Lastname, count(*)
From EMP
Where lastname = ‘Fay’
Group By Lastname
Having count(*) > 1;
LasteName
Count(*)
Fay
3

The post How to Find the Unique and Duplicate Data in a Table appeared first on Tech Insights.

]]>
https://reactconf.org/how-to-find-unique-and-duplicate-data_8985/feed/ 0 70