Last answered:

03 Sept 2024

Posted on:

29 Aug 2024

0

Resolved: SQL/SQL JOINS/Duplicate Records - using GROUP BY t.col_name doesnt work in my workbench

Hi Team, when practicing on my laptop with SQL with Learning 365DS course SQL, I see that eliminating duplicate records during joins with GROUP BY doesnt work. 
Do you have any suggestion why it coud happen? 
Thank you very much in advance and thank you for this interesting course.
1 answers ( 1 marked as helpful)
Instructor
Posted on:

03 Sept 2024

0
Hi Yaroslav!
Thanks for reaching out.

Some possible reasons are:
1) Inappropriate Join Conditions: Check your JOIN conditions to avoid producing a Cartesian product, which creates duplicates.
2) Misuse of GROUP BY: If you’re not using aggregate functions, consider using DISTINCT instead of GROUP BY.
3) Inconsistent Data Types: Normalize data to avoid unintentional duplicates.
These steps should help eliminate the duplicates during joins.


Hope this helps.
Best,
Tsvetelin

Submit an answer