Why am i getting duplicate rows with my join operation?

Example:

-- JOIN operation that might produce duplicates
SELECT A.name, B.order_id 
FROM customers A 
JOIN orders B ON A.id = B.customer_id;
Solution:

-- Using DISTINCT to avoid duplicates
SELECT DISTINCT A.name, B.order_id 
FROM customers A 
JOIN orders B ON A.id = B.customer_id;
JOIN can produce duplicate rows if there are multiple matching rows in the joined table. Using DISTINCT can help in eliminating those duplicates.

Beginner's Guide to SQL