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

Which two statements will return the names of the three employees with the lowest salaries? (Choose two.)

    Correct Answer: B, C

    To return the names of the three employees with the lowest salaries, the query needs to first order the employees by salary in ascending order and then limit the results to the first three. Option B uses an inline view to order by salaries and then uses rownum to limit the results, which achieves the desired outcome. Option C orders the employees by salary and then uses FETCH FIRST 3 ROWS ONLY to limit the results, which also works correctly. Therefore, options B and C are the correct choices for this query.

Discussion
kesammy9Options: BC

A. select last_name, salary from employees fetch first 3 rows only order by salary; - results in an error --------------------------------------------- B. select last_name, salary from ( select * from employees order by salary) where rownum <= 3; - works ------------------------------------------------------- c. select last_name, salary from employees order by salary fetch first 3 rows only ; - works ---------------------------------------------------------------- D. select last_name, salary from employees where rownum <= 3 order by salary; - returns the first 3 rows and orders the 3 rows based on salary so its incorrect ------------------------------------------------------- E. select last_name, salary from employees where rownum <= 3 order by (select salary from employees); - subquery returns more than one row so results in error

yanoolthecool

thx, u made me facepalm cuz I forgot that, thx again 4 help

ninjax_m

D is wrong after order by rownum might not anymore be sequential.

jfc1Option: D

D is the correct answer