Handling duplicates
Handling duplicates
To see a display of all the dates you entered, ordered by year, type:
SELECT
day, COUNT(day),
month, COUNT(month),
year, COUNT(year)
FROM
dates
GROUP BY
day,
month,
year
HAVING
COUNT(day) > 1
AND COUNT(month) > 1
AND COUNT(year) > 1;
The system will display any values that are duplicates. In this case, you
should see:
1. Create an intermediate table that has the same structure as the source
table and transfer the unique rows found in the source:
2. With that done, you can delete the source table with the drop
command and rename the new one:
For example:
The output will tell you how many rows have been affected, that is, how
many duplicate rows have been deleted.