+ 1
Help to solve the practice
Hello, I'm trying to solve the SQL practice 19.2 "What did you order?" And failing to do so. SELECT customers.fullname, customers.age, customers.address, orders.amount FROM customers RIGHT JOIN orders ON customers.id=orders.customerid; So it says: "Customers names should be outputted even if he/she doesn't have an order." and I don't understand how to do it. Can you help me out, please?
5 Respuestas
+ 2
Abhay
I found the solution. If we use "Right join" we should also change the order in that using "Left join".
Kakha Amashukeli
This is the solution buddy! You should change the order in your code.
SELECT customers.fullname, customers.age, customers.address, orders.amount
FROM orders RIGHT JOIN customers
ON orders.customerid = customers.id;
+ 2
I used left join. They are suggesting right join on assumption that we select orders table first.
+ 1
Abhay
I solved the problem as you solved. I didn't understand why it says "Use Right Join". Left is correct option I think.
+ 1
mesarthim yes that is what i said !
+ 1
Thanks all of you guys. It's solved.