What would happen when the above statement is executed?

View the Exhibit and examine PRODUCTS and ORDER_ITEMS tables.
You executed the following query to display PRODUCT_NAME and the number of times the product has been ordered:
SELECT p.product_name, i.item_cnt
FROM (SELECT product_id, COUNT (*) item_cnt
FROM order_items
GROUP BY product_id) i RIGHT OUTER JOIN products p ON i.product_id = p.product_id;
What would happen when the above statement is executed?

View the Exhibit and examine PRODUCTS and ORDER_ITEMS tables.

You executed the following query to display PRODUCT_NAME and the number of times the product has been ordered:
SELECT p.product_name, i.item_cnt
FROM (SELECT product_id, COUNT (*) item_cnt
FROM order_items
GROUP BY product_id) i RIGHT OUTER JOIN products p ON i.product_id = p.product_id;

What would happen when the above statement is executed?

A.
The statement would execute successfully to produce the required output.

B.
The statement would not execute because inline views and outer joins cannot be used together.

C.
The statement would not execute because the ITEM_CNT alias cannot be displayed in the outer query.

D.
The statement would not execute because the GROUP BY clause cannot be used in the inline view.



Leave a Reply 5

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


user

user

SELECT p.product_name, i.item_cnt
FROM (SELECT product_id, COUNT (*) item_cnt
FROM order_items
GROUP BY product_id) i RIGHT OUTER JOIN products p ON i.product_id = p.product_id;

user

user

select i.empno from (select * from emp) i join emp p on (i.empno = p.empno);

Ramu

Ramu

It would show error, select has product name, sub query has product id. ..

Rabi

Rabi

blind man ,it’s taking productname from different table