nerdexam
Oracle

1Z0-007 · Question #175

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…

The correct answer is A. The two statements produce identical results. These two statements produce identical results, because it is possible even to use numbers to indicate the column position where Oracle should order the output from a statement. Incorrect Answers B: Second statement is correct and it will not return a syntax error. C: The…

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

(42 responses)
  • A
    71% (30)
  • B
    17% (7)
  • C
    10% (4)
  • D
    2% (1)

Explanation

These two statements produce identical results, because it is possible even to use numbers to indicate the column position where Oracle should order the output from a statement. Incorrect Answers B: Second statement is correct and it will not return a syntax error. C: The results are sorted in ascending order by default. D: There is no corrections need to be made for the statements. They will return identical results.

Topics

#ORDER BY#column position alias#sort order#DESC

Community Discussion

No community discussion yet for this question.

Full 1Z0-007 Practice