sql sort column names alphabetically code example
Example 1: how to sort names in alphabetical order in sql
SELECT id,
first_name,
last_name,
FROM customer
ORDER BY last_name ASC;
Example 2: sql order by alphabetical
SELECT * FROM table_name ORDER BY col1 ASC; -- ASCending is default
SELECT * FROM table_name ORDER BY col1 DESC; -- DESCending
SELECT * FROM table_name ORDER BY col1 DESC, col2 ASC; -- col1 DESC then col2 ASC