ORDER BY and LIMIT
Learn how to sort columns in SQL table.
Step 1: Start with a question
You already know how to ask which rows to show. Now, let’s ask in what order. Imagine your familiar table employees.
What if you wanted to see who earns the most?
You would surely want to see all employees, sorted by salary from highest to lowest.
Prompt: Write a SQL query that lists employee first name, last name, and salary, sorted by salary from highest to lowest.
Ask AI to translate that question into SQL:
Powered by AI
5 Prompts Remaining
Step 2: Run and observe
AI might produce:
Run it. ...