View the Exhibits and examine the structures of the PRODUCTS SALES and CUSTOMERS
tables.You need to generate a report that gives details of the customer’s last name, name of
the product, and the quantity sold for all customers in Tokyo’. Which two queries give the
required result? (Choose two.)
A.
SELECT c.cust_last_name,p.prod_name, s.quantity_sold FROM sales s JOIN products p
USING(prod_id) JOIN customers c USING(cust_id) WHERE c.cust_city=’Tokyo’;
B.
SELECT c.cust_last_name, p.prod_name, s.quantity_sold FROM products p JOIN sales
s JOIN customers c ON(p.prod_id=s.prod_id) ON(s.cust_id=c.cust_id) WHERE
c.cust_city=’Tokyo’;
C.
SELECT c.cust_last_name, p.prod_name, s.quantity_sold FROM products p JOIN sales
s ON(p.prod_id=s.prod_id) JOIN customers c ON(s.cust_id=c.cust_id) AND
c.cust_city=’Tokyo’;
D.
SELECT c.cust_id,c.cust_last_name,p.prod_id, p.prod_name, s.quantity_sold FROM
products p JOIN saless USING(prod_id) JOIN customers c USING(cust_id) WHERE
c.cust_city=’Tokyo’;
For C, shouldn’t it be WHERE instead of AND?
NOTE: YOU CAN USE ‘AND’ OR ‘WHERE’ CLAUSE TO IMPOSE ADDITIONAL CONDITION IN A JOIN . YOU CAN TEST THE QUERY IF YOU WISH.
hi, what is wrong with d ?