List customer names who ordered Apple Laptop (Choose your own join type). I have
ID: 3807353 • Letter: L
Question
List customer names who ordered Apple Laptop (Choose your own join type). I have gour tables customer, orderline, ordertable, and product. I keep getting this error 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''product' where product_name = 'Apple Laptop'))) LIMIT 0, 25' at line 4
select customer.cust_name from customer where customer.cust_id in
(select cust_id from ordertable where order_id in
(Select order_id from orderline where product in
(Select product_id from product where product_name = 'Apple Laptop')))
Explanation / Answer
Fixed SQL:
select customer.cust_name from customer
inner join ordertable
on customer.cust_id=ordertable.cust_id
inner join orderline
on ordertable.order_id=orderline.order_id
inner join product
on orderline.product_id=product.product_id
where product.product_name = 'Apple Laptop'
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.