1z0-071 Exam QuestionsBrowse all questions from this exam

1z0-071 Exam - Question 111


Examine this partial statement:

SELECT ename, sal, comm FROM emp

Now examine this output:

Which ORDER BY clause will generate the displayed output?

Show Answer
Correct Answer: A

The correct ORDER BY clause needed to generate the displayed output is the one that orders based on the commission (comm) in descending order while placing nulls last, followed by ordering based on the employee name (ename) to ensure a secondary order. The ordering shown in the output indicates that the rows are sorted first by the comm values in descending order with non-null values appearing first, and then alphabetically by ename. Therefore, the correct clause is 'ORDER BY comm DESC NULLS LAST, ename'.

Discussion

4 comments
Sign in to comment
sunilrajusbOption: D
Sep 1, 2023

D also correct answer,, Tested and its giving expected output

Misi_Oracle
May 6, 2024

NVL lets you replace null (returned as a blank) with a string in the results of a query. If expr1 is null, then NVL returns expr2. If expr1 is not null, then NVL returns expr1. Meaning that the output would be replaced by 0. The output still remains as null. https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/NVL.html

RamuneleOption: A
Sep 20, 2023

D is not correct, because Turner is last in the table. A is correct answer

yaya32Option: A
Jan 18, 2024

A for me

9ramone7Option: A
Apr 9, 2024

Tested on Oracle live sql. A is correct query for the output B comm nulls are at the top - wrong C Turmer, Allen, Ward, Martin at the bottom - wrong D Only Turner at the bottom - wrong