Find duplicates with RANK
Let's clean out duplicates! Here's how.
1οΈβ£ Check if duplicates exists.
Use πΆππΎππΏ π±π + π²πΎππ½π(*) to find duplicates. See example 1 in image below.
2οΈβ£ Identify exact rows that are duplicated.
Use ππ°π½πΊ πΎπ
π΄π(πΏπ°πππΈππΈπΎπ½ π±π ππππ). See example 2.
What does ππ°π½πΊ πΎπ
π΄π(πΏπ°πππΈππΈπΎπ½ π±π ππππ) do?
π divides the table into multiple partitions, one for each unique value of cols, then
π assigns a rank from 1 to the number of rows in the partition, then
π returns more than 1 if the row is duplicated
You can even find duplicated values in TWO columns.
In example 3, I find duplicated show_name and actor_name with this:
ππ°π½πΊ πΎπ
π΄π(πΏπ°πππΈππΈπΎπ½ π±π ππππ _ππππ, πππππ_ππππ) > π·
As usual, full example below.