sql exclude duplicates code example
Example 1: sql query to find duplicates in column
SELECT name, COUNT(email)
FROM users
GROUP BY email
HAVING COUNT(email) > 1
Example 2: how to remove duplicate in sql
Distinct: helps to remove all the duplicate
records when retrieving the records from a table.
SELECT DISTINCT FIRST_NAME FROM VISITORS;
Example 3: sql exclude duplicates and find even id
SELECT DISTINCT city FROM tablename WHERE id % 2 = 0