SQL Lesson 4: Review & Practice – Crafting Real-World SELECT Queries

May 13, 2025 | Categories: Information

You've built a strong foundation with the basics of SQL:

  • Retrieving data using SELECT

  • Filtering results using WHERE

  • Removing duplicates with DISTINCT

  • Sorting with ORDER BY

  • Limiting results with LIMIT and OFFSET

Now it’s time to take a step back, review what you’ve learned, and apply your knowledge to practical questions — just like you would in real projects.

In this review lesson, you'll:

✅ Revisit core query syntax
✅ Analyze real-world questions
✅ Practice combining multiple SQL clauses to answer them

These tasks will strengthen your skills and boost your confidence before we dive into joins and aggregations in upcoming lessons.

🔄 Core Query Structure Recap

Here's the basic format of a flexible SQL query that uses everything you’ve learned so far:

SELECT column1, column2
FROM table_name
WHERE condition
ORDER BY column1 DESC
LIMIT 5 OFFSET 10;

This single query can be shaped to answer a wide range of data questions.

🏛️ Review Table: top_universities

Let’s switch things up. Instead of movies, you’ll now be working with a new dataset featuring some of the world’s top universities.

Here’s a simplified version of the top_universities table:

id university_name country city student_count founded_year
1 Harvard University USA Cambridge 21000 1636
2 University of Oxford UK Oxford 24000 1096
3 Stanford University USA Stanford 17000 1885
4 University of Tokyo Japan Tokyo 28000 1877
5 ETH Zurich Switzerland Zurich 23000 1855

🧭 Common Pitfalls (And How to Avoid Them)

🚫 Forgetting SELECT before FROM
Always start your queries with what you want to retrieve.

🚫 Using = instead of LIKE (or vice versa)
Remember = works for exact matches. LIKE is for patterns (we’ll dive deeper in a future lesson).

🚫 Using ORDER BY without specifying ASC or DESC
It defaults to ascending (ASC), but it’s best to be explicit — especially when showing top results.


✅ What You Should Be Able to Do After This

By now, you should feel comfortable with:

  • Writing SELECT queries from scratch

  • Filtering data using conditions

  • Sorting and slicing result sets

  • Answering simple analytical questions using SQL

If you’re stuck, try breaking your query into steps. Think about:

  • What do I want to see? → SELECT

  • Where does the data come from? → FROM

  • Should I filter some rows? → WHERE

  • Do I need to sort or limit? → ORDER BY, LIMIT, OFFSET


📝 What’s Next?

In the next lesson, we’ll expand your querying power by learning how to combine information from multiple tables using JOINs. This is where SQL really starts to shine and gets closer to real-world database work.

Stay curious — and keep querying!


Ready to practice SQL? Try our coding challenges →