View the Exhibits and examine the structures of the CUSTOMERS, SALES, and COUNTRIES
tables.
You need to generate a report that shows all country names, with corresponding customers (if
any) and sales details (if any), for all customers.
Which FROM clause gives the required result?
A.
FROM sales JOIN customers USING (cust_id)
FULL OUTER JOIN countries USING (country_id);
B.
FROM sales JOIN customers USING (cust_id)
RIGHT OUTER JOIN countries USING (country_id);
C.
FROM customers LEFT OUTER JOIN sales USING (cust_id)
RIGHT OUTER JOIN countries USING (country_id);
D.
FROM customers LEFT OUTER JOIN sales USING (cust_id)
LEFT OUTER JOIN countries USING (country_id);
Why option A is not correct?
A RIGHT OUTER JOIN is one of the JOIN operations that allow you to specify a JOIN clause. It preserves the unmatched rows from the second (right) table, joining them with a NULL in the shape of the first (left) table. A LEFT OUTER JOIN B is equivalent to B RIGHT OUTER JOIN A, with the columns in a different order.
Think in terms of “where I need preserve data”.
I want to preserve all countries, even if there are no customers.
I want to preserve all customers, even if there are no sales.
Stay tuned to the words “if any”:
“You need to generate a report that shows all country names, with corresponding customers (if any) and sales details (if any), for all customers.”
Hélcio.
Hair Extensions Toronto
http://www.XquielQMVW.com/XquielQMVW