1Z0-071 practice question 21 of 35
Which two statements will return the names of the three employees with the lowest salaries?
Full set: 326 questionsTo find the employees with the lowest salaries, the query must first sort all employees by salary in ascending order and then select the first three rows from the sorted result set. The row-limiting clause (FETCH FIRST ... ROWS ONLY), introduced in Oracle 12c, is designed for this purpose. It is applied after the ORDER BY clause, ensuring the correct top-N result. Option B correctly implements this logic. Although the question asks for two statements, only option B is correct among the choices provided.
A: The WHERE ROWNUM<=3 predicate is applied before any sorting, returning three arbitrary rows from the table, not necessarily the ones with the lowest salaries. C: The WHERE ROWNUM<=3 is applied before sorting. The ORDER BY clause is also syntactically incorrect and would fail. D: This query sorts all employees but does not limit the result to three rows; it returns all employees. E: The ORDER BY clause is processed after the FETCH clause, meaning it would fetch three arbitrary rows and then sort only those three.
Oracle Database SQL Language Reference, 19c, "ORDER BY Clause" and "rowlimitingclause". The documentation specifies the order of execution, showing that the ORDER BY clause is processed before the FETCH clause, making it suitable for top-N queries.
Oracle Database SQL Language Reference, 19c, "SELECT". The syntax diagram and semantics confirm that FETCH is part of the ORDER BY clause's extensions for row limiting.
Keep practicing
Take the free 1Z0-071 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 1Z0-071 practice questions
- Question 2Which three statements are true about single row functions?
- Question 3Which statement executes successfully?
- Question 4Which two are true about transactions in the Oracle Database?
- Question 6Which two are true about external tables that use the ORACLE _DATAPUMP access driver?
- Question 9Which statement will execute successfully?
- Question 10Examine this statement: CREATE TABTE orders (sarial_no NUMBER UNIQUE, order_id NUMBER PRI…
