Reputation: 301
I've read a book about SQL and found that you can sort the data from columns in descending och ascending order. But from my point of view, i dont understand why you would use order by ASC instead of just order by
Example:
SELECT state FROM country ORDER BY state;
SELECT state FROM country ORDER BY state ASC;
Why did they bother to implement ASC since just ordering by the column name brings the same result?
Upvotes: 0
Views: 530
Reputation: 11135
Ommiting ASC
is just a trick to reduce verbosity. Like ommiting INNER
(from INNER JOIN
) and so on.
Upvotes: 0
Reputation: 253
Sometimes it helps to be overly verbose so that others can more easily/quickly understand your query. For example, maybe you are writing a stored procedure with a decision structure such that one branch sorts ascending and the other descending. By being explicit you can emphasize to the reader the difference between the two branches.
Just a thought.
Upvotes: 3