Explain the SQL ORDER BY statement. Write SQL syntax for the SQL ORDER BY statement along with an example.
ORDER BY: It is used to sort columns of a result set. It sorts columns in ascending order by default. DESC can be used to sort in a descending order.
Syntax:
SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC
Example:
SELECT balance FROM Account ORDER BY balance DESC
No comments:
Post a Comment