nerdexam
Oracle

1Z0-061 · Question #286

View the Exhibit and examine the data in the PROMO_CATEGORY and PROMO_COST columns of the PROMOTIONS table. Evaluate the following two queries: SQL>SELECT DISTINCT promo_category…

The correct answer is B. Only the second query executes successfully. Note: You cannot use column alias in the WHERE clause.

Restricting and Sorting Data

Question

View the Exhibit and examine the data in the PROMO_CATEGORY and PROMO_COST columns of the PROMOTIONS table. Evaluate the following two queries:

SQL>SELECT DISTINCT promo_category to_char(promo_cost)"code" FROM promotions ORDER BY code; SQL>SELECT DISTINCT promo_category promo_cost "code" FROM promotions ORDER BY 1; Which statement is true regarding the execution of the above queries?

Exhibit

1Z0-061 question #286 exhibit

Options

  • AOnly the first query executes successfully.
  • BOnly the second query executes successfully.
  • CBoth queries execute successfully but give different results.
  • DBoth queries execute successfully and give the same result.

How the community answered

(50 responses)
  • A
    14% (7)
  • B
    78% (39)
  • C
    6% (3)
  • D
    2% (1)

Explanation

Note: You cannot use column alias in the WHERE clause.

Topics

#DISTINCT#column alias#ORDER BY#query execution

Community Discussion

No community discussion yet for this question.

Full 1Z0-061 Practice