This duplicate check compares the row count TO ITSELF, so it always prints dupes: 0. Fix the second query to count DISTINCT rows so it prints dupes: 1.
The break is on line 9 — but read the whole snippet first.
This duplicate check compares the row count TO ITSELF, so it always prints dupes: 0. Fix the second query to count DISTINCT rows so it prints dupes: 1.