SQL & Databases
Your browser doesn't support speech here. You can still read everything, or try Chrome, Edge or Safari.

← All courses

Course 2 of 10 · Beginner

SQL & Databases

Ask questions of your data. SELECT and filtering, grouping, joins, subqueries, CTEs and window functions, designing tables, and SQL for machine learning, with a live database in the page.

How this course works

Welcome

  • Level: Beginner. You need: Nothing, though a little Python helps for the last topic.
  • Every query runs on a real database inside the page: edit it, press Run and see the table. Nothing to install.
  • The example database is a small online shop: customers, products, orders and order items.
  • Pick a topic from the sidebar; they go in order. Press ▶ Play this topic to hear a lesson read aloud, or 🔊 Explain on one section.
  • Topics climb from Beginner to Intermediate · Maths, Advanced and Code; use the Show chips to hide levels you don't need. Most have a Watch it animation, Try it demos and runnable code examples, and every topic ends with a quiz: answer it to mark the topic done ✓.
  • Stuck? Press 💬 Ask the AI tutor: a small free AI model that runs on your own device and answers from the course.
  • Progress is saved in this browser and shared across all the courses on this site.

Learning path: 🐍 Python → 🗄️ SQL & Databases → ∑ Maths for AI → 📈 Machine Learning → 🧠 Deep Learning → 👁️ Computer Vision → 💬 Natural Language Processing → ✨ Generative AI & LLM Apps → 🚀 Flask & Deployment → 🔬 Becoming an AI Researcher

Getting started

Querying data

3. SELECT: Choosing Columns, Sorting & LimitingThe shape of every query: SELECT columns FROM a table. Pick and rename columns, calculate new ones, remove duplicates with DISTINCT, sort with ORDER BY, and take the top rows with LIMIT.4. WHERE: Filtering RowsKeep only the rows you want: comparisons, AND, OR and NOT, ranges with BETWEEN, lists with IN, text patterns with LIKE, and NULL, the value that means "unknown", which trips up everyone at least once.5. Functions: Text, Numbers, Dates & CASEClean and reshape values inside a query: text functions (UPPER, LENGTH, SUBSTR, TRIM, REPLACE, joining text), rounding, dates (extracting the month, adding days, the gap between dates), CASE for if/else logic, COALESCE for missing values, and CAST.6. Summarising Data: COUNT, SUM, GROUP BY & HAVINGTurn many rows into answers: aggregate functions (COUNT, SUM, AVG, MIN, MAX), the three kinds of COUNT, splitting rows into groups with GROUP BY, filtering groups with HAVING, and the rule that catches every beginner.7. Joining Tables: INNER, LEFT & MoreCombine tables by following their keys: why data is split across tables, INNER JOIN, LEFT JOIN, finding things with no match, joining three or four tables, self-joins, and the fan-out trap that silently inflates totals.8. Subqueries & Set OperationsUse the answer of one query inside another: subqueries that return one value, a list or a whole table, EXISTS and NOT EXISTS, correlated subqueries, and stacking results with UNION, INTERSECT and EXCEPT.9. CTEs & Window FunctionsWrite complex queries as readable steps with WITH (common table expressions), then use window functions to rank rows, number them, compare each row with the previous one, and compute running totals, without losing any rows.

Building databases

SQL in practice

SQL for machine learning

SQL in practice

When you finish

Next course

Ready