Exam 1z0-082 All QuestionsBrowse all questions from this exam
Question 20

Which two statements are true about the ORDER BY clause when used with a SQL statement containing a SET operator such as UNION? (Choose two.)

    Correct Answer: B, C

    When using the ORDER BY clause in a SQL statement containing a SET operator such as UNION, only column names from the first SELECT statement in the compound query are recognized. Additionally, the first column in the first SELECT statement of the compound query is used by default to sort output in the absence of an ORDER BY clause. These rules ensure that the ordering of the output is clear and consistent across the entire result set.

Discussion
danitoOptions: BC

B C are the corrects

ama

evidence ?

Ekos

i agree

you1234Options: BC

B & C is correct answer

ama

Yes!!! B and C are correct

emburriaOptions: BC

B, C are correct. It's incredible how (nearly) all the answers they give are worng

AbdullejrOptions: BC

B and C without doubt.

jagz3000Options: BC

i agree

nautil2Options: BC

A - FALSE; column ord_no is part of the primary key, hence it cannot be NULL. There is no default value after sequence is dropped. When an attempt to insert a row without ord_no specified is made, an error ORA-02289 occurs. B - TRUE; if GRANT SELECT is missing, an error "ORA-00942: table or view does not exists" occurs after INSERT attempt C - TRUE; tested D - FALSE; it cycles after value 100000 is reached, so after value 100000, next value is 1 E - FALSE; sequence cycles, so when MAXVALUE is reached, duplicates can occur

nautil2

I am sorry, answers above belong to another question. Right answers are: A - FALSE; e.g. SELECT dept_no,ename FROM emp UNION SELECT deptno,ename FROM employees ORDER BY ename; B - TRUE; tested; not documented in SQL Reference, but works C - TRUE; tested; NULLs are last in output D - FALSE; Release 19 SQL Reference: "Also, the ORDER BY clause can appear only in the last component query. The ORDER BY clause orders all rows returned by the entire compound query." E - FALSE; see D

Oracle2020Options: BC

The E is not correct because in the Union statement composition you add an ORDER BY clause to the last SELECT statement A is incorrect because the column composition has no reason to be used in the order by, you can use only one of the columns to sort only the first select list , if it has more than one column. B is correct because indeed the names of the columns of the first select list are those that are shown in the output of the query and are recognized C is correct So by default the correct answers are B and C

zouveOptions: BC

BC for me

auwiaOptions: AB

Tip: to answer this question you should read the answers from bottom and try to find out a possible reason why E is false! :)

mamaduOptions: BC

correct statements.

auwiaOptions: BE

Provided answer are correct: A. Column positions must be used in the ORDER BY clause --> False, you can use column name too. B. Only column names from the first SELECT statement in the compound query are recognized --> True C. The first column in the first SELECT of the compound query with the UNION operator is used by default to sort output in the absence of an ORDER BY clause --> False, to have an order, you must use ORDER BY clause. D. Each SELECT statement in the compound query must have its own ORDER BY clause. False, ORDER BY clause is optional. E. Each SELECT statement in the compound query can have its own ORDER BY clause --> True

mamadu

C = true , try querying a table without an order by, you will still get the records ordered by the first column of the table.

auwia

it's just a case because probably you used few records, try with milion records maybe splitted in partitions ... maybe it's still working, but Oracle doesn't garantee you any order if you don't use the ORDER BY clause. At least you can try to find an official Oracle link saying that the sentence is True, but I don't think you'll be able to find one! :)

trgbigheroOptions: BC

BC is correct

algerianphoenixOptions: BC

B,C Correct answers.

ryuahOptions: BC

B,C is correct

mianjeeOptions: BC

select employee_id,last_name "Last Name" FROM employees where employee_id=101 union select employee_id EMP_NO, last_name from employees where employee_id=113; C is correct.

you1234

Please ignore this - I want to type for other question B is wrong - you can insert if you have insert privilege on table from other schema. not required separate privileges on sequence.

you1234

B is wrong - you can insert if you have insert privilege on table from other schema. not required separate privileges on sequence.