nerdexam
Oracle

1Z0-007 · Question #110

Evaluate these two SQL statements: SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC; SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC; What is true about them?

The correct answer is A. The two statements produce identical results. the two statement produce identical results as ORDER BY 2 will take the second column as Incorrect answer: B there is no syntax error C result are sorted in ascending order by default D ORDER BY 2 will take the second column as

Restricting and Sorting Data

Question

Evaluate these two SQL statements:

SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC; SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC; What is true about them?

Options

  • AThe two statements produce identical results.
  • BThe second statement returns a syntax error.
  • CThere is no need to specify DESC because the results are sorted in descending order by default.
  • DThe two statements can be made to produce identical results by adding a column alias for the salary

How the community answered

(58 responses)
  • A
    81% (47)
  • B
    3% (2)
  • C
    5% (3)
  • D
    10% (6)

Explanation

the two statement produce identical results as ORDER BY 2 will take the second column as Incorrect answer: B there is no syntax error C result are sorted in ascending order by default D ORDER BY 2 will take the second column as

Topics

#ORDER BY#positional reference#column alias#sorting

Community Discussion

No community discussion yet for this question.

Full 1Z0-007 Practice