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.)
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.)
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.
B C are the corrects
evidence ?
i agree
B & C is correct answer
Yes!!! B and C are correct
B, C are correct. It's incredible how (nearly) all the answers they give are worng
B and C without doubt.
i agree
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
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
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
BC for me
Tip: to answer this question you should read the answers from bottom and try to find out a possible reason why E is false! :)
correct statements.
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
C = true , try querying a table without an order by, you will still get the records ordered by the first column of the table.
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! :)
BC is correct
B,C Correct answers.
B,C is correct
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.
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.
B is wrong - you can insert if you have insert privilege on table from other schema. not required separate privileges on sequence.