【OCP認證12c題庫】CUUG 071題庫考試原題及答案(28)

28.choose the best answer

Evaluate the following SQL statement:

SQL> SELECT promo_id, promo_category

FROM promotions

WHERE promo_category = 'Internet' ORDER BY 2 DESC

UNION

SELECT promo_id, promo_category

FROM promotions

WHERE promo_category = 'TV'

UNION

SELECT promo_id, promo_category

FROM promotions

WHERE promo_category ='Radio';

Which statement is true regarding the outcome of the above query?

A) It produces an error because the ORDER BY clause should appear only at the end of a compound query-that is, with the last SELECT statement.

B) It executes successfully and displays rows in the descending order of PROMO_CATEGORY.

C) It produces an error because positional notation cannot be used in the ORDER BY clause with SET operators.

D) It executes successfully but ignores the ORDER BY clause because it is not located at the end of the compound statement.

Answer:A

(執行時 order by 子句只能出現最後的 select 語句,否則出現“ORA-00933: SQL 命令未正確結束”錯誤)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章