Exam 1z0-071 All QuestionsBrowse all questions from this exam
Question 45

Examine this statement:

Which two statements are true? (Choose two.)

    Correct Answer: A, B

    The statement first orders the employees by whether their salary is the maximum, assigning them the value 'A' if it is. This means the names of employees earning the maximum salary will appear first, but since there's no specified order for 'A', they appear in an unspecified order. All other employees are then ordered by their last name in descending order as specified by the 'last_name DESC' clause.

Discussion
ShrimathiOptions: DF

DF is the correct create table emp(last_name varchar2(100), salary number); insert all into emp values('Shri',5000) into emp values('van',5000) into emp values('ben',15000) into emp values('zoo',15000) into emp values('cat',4000) select * from dual; output: zoo ben Shri cat van

Shrimathi

zoo,ben contains highest salary , it appears in descending order. And remaining orders appear in an unspecified order

Shrimathi

zoo,ben contains highest salary , it appears in descending order. And remaining orders appear in ascending order

yanoolthecool

I was also a bit confused as they appeared unordered, but looking closer they are, note that the 'S' is capital, which has lower ANSI value.

yanoolthecoolOptions: AB

A. The names of employees earning the maximum salary will appear first in an unspecified order: Because if there more than one employ with the same salary the order is unspecified cuz both will use 'A' letter. B. All remaining employee names will appear in descending order. Because there is last_name DESC I should just google the answers instead of depending on the ones here...

NennuzzoOptions: DF

DF is correct

samuele1981Options: AB

A. The names of employees earning the maximum salary will appear first in an unspecified order: Because if there more than one employ whit the same salary the order is unspecified. B. All remaining employee names will appear in descending order. Because there is last_name DESC

JuciDelevatiOptions: DF

DF is correct

alic_alexOptions: DF

DF is correct, I have checked in DB

dexdinh91Options: DF

DF is correct

dexdinh91

https://www.educba.com/sql-order-by-case/

Ramona13Options: BE

BE is correct

NelitaOptions: DE

D/E ARE CORRECT.

cadcadleyOptions: DF

DF is correct

iuliana23

Can someone explain me why D and F are correct?

karols32

I tested it and these answers are correct. Employees which have not a highest salary appear in ascending order and it's true because ELSE starts working and it sorts by last_name ASC(as default for sorting without giving any postfix). But the second answer, F one is interesting because where it appear, depends from a character after THEN. We have 'A' now and employees with highest salary comes first but when I replace it by 'B' employees appear from 5th row, by 'C' from 14th row. It sorts by last_name DESC, take it from end of query'.

ninjax_m

D. All remaining employee names will appear in ascending order. Ascending is default ordering. case - else outputs employee name that should be sorted ascending. F. The names of employees earning the maximum salary will appear first in descending order. They appear first because of 'A' , then after that they are sorted by name, but in descending order (2nd order by clause).