SQL how to sort a table by value 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 reverse order of results
SELECT q.*
FROM (SELECT TOP 3 *
FROM table
ORDER BY id DESC) q
ORDER BY q.id ASC