Blog · Guide
How SQL ORDER BY Works (Sort Your Results)
ORDER BY sorts the result ascending or descending — one column or several. Here’s the pattern you’ll reuse forever.
A → Z and low → high by default
SELECT first_name, city FROM customers ORDER BY first_name;
Default is ASC (ascending). For expensive-first products use ORDER BY price DESC.
Sort by two columns
Need country, then city inside each country? List them in priority order:
ORDER BY country, cityFirst key wins; the second only breaks ties.
Try it yourself
The fastest way to lock this in is a short drill on the same Northstar Market tables.