Which statement is true regarding the outcome of this query?

You issue the following query:
SQL> SELECT AVG(MAX(qty))
FROM ord_items
GROUP BY item_no
HAVING AVG(MAX(qty))>50;
Which statement is true regarding the outcome of this query?
A. It executes successfully and gives the correct output.
B. It gives an error because the HAVING clause is not valid.
C. It executes successfully but does not give the correct output.
D. It gives an error because the GROUP BY expression is not valid.

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “Which statement is true regarding the outcome of this query?

  1. The reason why HAVING AVG(MAX(qty))>50; would not work is because statement below would not work either.

    SELECT AVG(MAX(qty)) FROM order_items;

    When nesting group functions, you must aggregate via GROUP BY. Without it nested group functions won’t work.
    So, when you left HAVING AVG(MAX(qty))>50 as is , it is equivalent to SELECT AVG(MAX(qty)) FROM ord_items;

    Don’t forget you can’t nest group functions more than two levels.

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.