Your browser doesn't support speech here. You can still read everything, or try Chrome, Edge or Safari.
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
1. SQL Course: Start HereNo experience needed. What a database is, what SQL does, the shop database you will practise on, how each lesson works, and your very first queries.2. Set Up SQL on Your ComputerRun SQL on your own machine: SQLite and DB Browser for SQLite (the easiest start), the sqlite3 command line, DBeaver as an all-in-one tool, PostgreSQL for job-ready skills, and loading a .sql or .csv file.
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
10. Creating Tables: Types, Keys & ConstraintsBuild your own tables with CREATE TABLE: choose data types, add a primary key, link tables with foreign keys, and protect the data with NOT NULL, UNIQUE, CHECK and DEFAULT. Then change or remove tables with ALTER and DROP.11. Changing Data: INSERT, UPDATE, DELETE & TransactionsAdd, change and remove rows safely: INSERT (one row, many rows, or from a query), UPDATE and DELETE with WHERE, "insert or update" (upsert), and transactions that make several changes all-or-nothing.12. Designing a Database: Relationships, Normalisation, Indexes & ViewsTurn a real problem into tables: entities and relationships (one-to-many, many-to-many), drawing an ER diagram, normalisation (each fact in one place), indexes that make queries fast, query plans, and views.
SQL in practice
SQL for machine learning
SQL in practice
When you finish