Machine-translated by Google. Questions are authored in English.
Top

Discussion

The rows of the result relation produced by a SELECT statement can be sorted, but only by one column.

  • A.True
  • B.False

Answer: B

Correct answer: False

ORDER BY accepts a list of columns, each with its own direction: ORDER BY dept ASC, salary DESC sorts by department and then, within each department, by descending salary.

The later columns act as tie-breakers, which is what makes multi-column sorting useful rather than merely possible. Expressions and column positions are also permitted, so ORDER BY LENGTH(name) or ORDER BY 2 are valid, though the numeric form is fragile when the SELECT list changes.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.