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

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?

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 executes successfully and displays rows in the descending order of PROMO_CATEGORY.

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

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

D.
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.



Leave a Reply 8

Your email address will not be published. Required fields are marked *


banu

banu

Has anyone tried executing this query? did it throw an error as mentioned?

Justyna

Justyna

yes, in this kind of select statements clause ‘order by’ is allowed only at the end of whole statement.

Google

Google

Here are a few of the websites we advise for our visitors.

注管理システム

注管理システム

one of our visitors recently suggested the following website

satta matka

satta matka

check below, are some absolutely unrelated sites to ours, having said that, they may be most trustworthy sources that we use

app maker

app maker

we prefer to honor lots of other world-wide-web web pages around the web, even though they arent linked to us, by linking to them. Beneath are some webpages really worth checking out

satta matka

satta matka

Every after inside a while we pick blogs that we study. Listed beneath would be the most recent web pages that we select