nerdexam
Oracle

1Z0-071 · Question #222

View the Exhibit and examine the structure of the SALES table. The following query is written to retrieve all those product IDs from the SALES table that have more than 55000 sold and have been…

The correct answer is C. It produces an error because COUNT(*) should be only in the HAVING clause and not in the. See the full explanation below for the reasoning.

Question

View the Exhibit and examine the structure of the SALES table. The following query is written to retrieve all those product IDs from the SALES table that have more than 55000 sold and have been ordered more than 10 times. SQL> SELECT prod_id FROM sales WHERE quantity_sold > 55000 and COUNT() > 10 GROUP BY prod_id HAVING COUNT() > 10; Which statement is true regarding this SQL statement?

Exhibit

1Z0-071 question #222 exhibit

Options

  • AIt executes successfully and generates the required result.
  • BIt produces an error because COUNT(*) should be specified in the SELECT clause also.
  • CIt produces an error because COUNT(*) should be only in the HAVING clause and not in the
  • DIt executes successfully but produces no result because COUNT(prod_id) should be used instead of

How the community answered

(63 responses)
  • A
    2% (1)
  • B
    10% (6)
  • C
    84% (53)
  • D
    5% (3)

Community Discussion

No community discussion yet for this question.

Full 1Z0-071 Practice