nerdexam
Oracle

1Z0-061 · Question #306

View the Exhibit and examine the structure of the PRODUCTS table. You want to display the category with the maximum number of items. You issue the following query: SQL>SELECT COUNT()…

The correct answer is C. It generates an error because the subquery does not have a GROUP BY clause. See the full explanation below for the reasoning.

Question

View the Exhibit and examine the structure of the PRODUCTS table. You want to display the category with the maximum number of items. You issue the following query:

SQL>SELECT COUNT(), prod_category_id FROM products GROUP BY prod_category_id HAVING COUNT() = (SELECT MAX(COUNT(*)) FROM products); What is the outcome?

Options

  • AIt executes successfully and gives the correct output.
  • BIt executes successfully but does not give the correct output.
  • CIt generates an error because the subquery does not have a GROUP BY clause.
  • DIt generates an error because = is not valid and should be replaced by the IN operator.

How the community answered

(68 responses)
  • A
    4% (3)
  • B
    3% (2)
  • C
    78% (53)
  • D
    15% (10)

Community Discussion

No community discussion yet for this question.

Full 1Z0-061 Practice