Module 55: SQL Fundamentals

Lesson 4 of 5 · 15–25 minutes

SELECT, filtering and sorting

🏠The everyday picture

Asking the register clerk: "Show me names and phone numbers of customers in Patna who joined this year, newest first, just the first ten."

📘What it really is

SELECT name, phone, joined_on
FROM customers
WHERE city = 'Patna'
  AND joined_on >= '2026-01-01'
ORDER BY joined_on DESC
LIMIT 10;

🖱️Try it

Write queries for: customers from Patna or Gaya, sorted by name; customers whose name starts with "R"; customers with no email; the five most recently joined customers; the list of distinct cities.

✅Quick check

What's the difference between WHERE and ORDER BY?

Show the answer

WHERE chooses which rows appear; ORDER BY sorts them.

How do you find customers whose email is missing?

Show the answer

WHERE email IS NULL.

← PreviousINSERT, UPDATE and DELETE
ProLearners Assist