nerdexam
Oracle

1Z0-061 · Question #135

See the Exhibit and examine the structure of the PROMOTIONS table: Using the PROMOTIONS table, you need to find out the average cost for all promos in the range $0-2000 and $2000-5000 in category A…

The correct answer is B. It executes successfully and gives the required result. Facilitates conditional inquiries by doing the work of an IF-THEN-ELSE statement: CASE expr WHEN comparison_expr1 THEN return_expr1 [WHEN comparison_expr2 THEN return_expr2 WHEN comparison_exprn THEN return_exprn

Reporting Aggregated Data using the Group Functions

Question

See the Exhibit and examine the structure of the PROMOTIONS table:

Using the PROMOTIONS table, you need to find out the average cost for all promos in the range $0-2000 and $2000-5000 in category A. You issue the following SQL statements:

What would be the outcome?

Exhibits

1Z0-061 question #135 exhibit 1
1Z0-061 question #135 exhibit 2

Options

  • AIt generates an error because multiple conditions cannot be specified for the WHEN clause
  • BIt executes successfully and gives the required result
  • CIt generates an error because CASE cannot be used with group functions
  • DIt generates an error because NULL cannot be specified as a return value

How the community answered

(50 responses)
  • A
    8% (4)
  • B
    74% (37)
  • C
    14% (7)
  • D
    4% (2)

Explanation

Facilitates conditional inquiries by doing the work of an IF-THEN-ELSE statement: CASE expr WHEN comparison_expr1 THEN return_expr1 [WHEN comparison_expr2 THEN return_expr2 WHEN comparison_exprn THEN return_exprn

Topics

#CASE expression#group functions#AVG#conditional aggregation

Community Discussion

No community discussion yet for this question.

Full 1Z0-061 Practice