Problems / Duplicate Detection Report / Editorial
GROUP BY guest_email, checkin_date
2024-06-01
2024-06-10
HAVING COUNT(*) > 1
HAVING
WHERE
COUNT(*)
dup_count
dup_count DESC, guest_email
Detection before deletion: reporting duplicates with GROUP BY key HAVING COUNT(*) > 1 is the standard audit query run *before* any destructive dedup, so the team can inspect what would be removed. Getting the natural key right is the whole game — grouping by guest_email alone or checkin_date alone both over-report (this dataset punishes each mistake). In PySpark, HAVING is expressed as a .filter() applied after .agg().
GROUP BY key HAVING COUNT(*) > 1
guest_email
checkin_date
.filter()
.agg()
Solve Duplicate Detection Report yourself →