Which two JOIN options can be used in the blank in the above query to get the required output?

View the Exhibit and examine the structure of the SALES and PRODUCTS tables.

In the SALES table, PROD_ID is the foreign key referencing PROD_ID in the PRODUCTS table.
You want to list each product ID and the number of times it has been sold.
Evaluate the following query:
SQL>SELECT p.prod_id, COUNT(s.prod_id)
FROM products p _____________ sales s
ON p.prod_id = s.prod_id
GROUP BY p.prod_id;
Which two JOIN options can be used in the blank in the above query to get the required output?
(Choose two.)

View the Exhibit and examine the structure of the SALES and PRODUCTS tables.

In the SALES table, PROD_ID is the foreign key referencing PROD_ID in the PRODUCTS table.
You want to list each product ID and the number of times it has been sold.
Evaluate the following query:
SQL>SELECT p.prod_id, COUNT(s.prod_id)
FROM products p _____________ sales s
ON p.prod_id = s.prod_id
GROUP BY p.prod_id;
Which two JOIN options can be used in the blank in the above query to get the required output?
(Choose two.)

A.
JOIN

B.
FULL OUTER JOIN

C.
LEFT OUTER JOIN

D.
RIGHT OUTER JOIN



Leave a Reply 5

Your email address will not be published. Required fields are marked *


RJ RON

RJ RON

Answer: BC

Alisha

Alisha

how?

dames

dames

BC include products with 0 sales.

Eamon

Eamon

@dames, I agree
Answer B includes products even though they have no sales.
Answer C gives the same output as answer B but it also includes all sales with no associated products, not ideal, but this question requires 2 answers and answer C does provide the required output.

Michal

Michal

Assuming prod_id is foreign key in sales and is part of primary key – then there can’t be any sales record without associated product.