nerdexam
Oracle

1Z0-082 · Question #43

Table ORDER_ITEMS contains columns ORDER_ID, UNIT_PRICE and QUANTITY, of data type NUMBER. Examine these SQL statements: Statement 1: SELECT MAX(unit_price quantity) "Maximum Order" FROM…

The correct answer is C. Both statements will return NULL if either UNIT_PRICE or QUANTITY contains NULL. E. Statement 2 may return multiple rows of output. See the full explanation below for the reasoning.

SQL and PL/SQL

Question

Table ORDER_ITEMS contains columns ORDER_ID, UNIT_PRICE and QUANTITY, of data type NUMBER. Examine these SQL statements:

Statement 1:

SELECT MAX(unit_price * quantity) “Maximum Order” FROM order_items; Statement 2:

SELECT MAX(unit_price * quantity) “Maximum Order” FROM order_items GROUP BY order_id; Which two statements are true?

Options

  • AStatement 1 returns only one row of output.
  • BStatement 2 returns only one row of output.
  • CBoth statements will return NULL if either UNIT_PRICE or QUANTITY contains NULL.
  • DBoth the statements give the same output.
  • EStatement 2 may return multiple rows of output.

How the community answered

(48 responses)
  • A
    17% (8)
  • B
    8% (4)
  • C
    71% (34)
  • D
    4% (2)

Topics

#MAX function#GROUP BY#NULL handling#aggregate functions

Community Discussion

No community discussion yet for this question.

Full 1Z0-082 Practice