Himanshu SharmaSoftware engineer
Let’s talk

Beginner to intermediate · 49 lessons

SQL for beginners

A free SQL course for beginners. Short lessons on a small company database cover SELECT, filtering, joins, grouping, subqueries, window functions and designing tables, with the output of every query shown and checked.

Syllabus

Getting started

  1. What SQL is and how databases work10 min
  2. The sample company database12 min
  3. SELECT: reading data12 min
  4. Aliases and calculated columns12 min
  5. DISTINCT: removing duplicates10 min

Filtering and sorting

  1. WHERE: filtering rows12 min
  2. AND, OR, NOT and parentheses12 min
  3. IN, BETWEEN and LIKE13 min
  4. NULL: missing values13 min
  5. ORDER BY: sorting12 min
  6. LIMIT, OFFSET and paging12 min

Functions and expressions

  1. String functions15 min
  2. Numeric functions14 min
  3. Date and time functions16 min
  4. CASE: conditions inside a query15 min
  5. CAST, COALESCE and NULLIF14 min

Summarising data

  1. COUNT, SUM, AVG, MIN and MAX15 min
  2. GROUP BY16 min
  3. HAVING: filtering groups13 min
  4. The order a query runs in14 min

Combining tables

  1. Relationships between tables14 min
  2. INNER JOIN16 min
  3. LEFT JOIN and RIGHT JOIN18 min
  4. FULL and CROSS joins15 min
  5. Self joins15 min
  6. Joining three or more tables17 min
  7. UNION, INTERSECT and EXCEPT15 min

Subqueries and CTEs

  1. Subqueries17 min
  2. Correlated subqueries16 min
  3. EXISTS and NOT EXISTS14 min
  4. Common table expressions (WITH)16 min
  5. Recursive CTEs17 min

Window functions

  1. Window functions: OVER and PARTITION BY14 min
  2. ROW_NUMBER, RANK and DENSE_RANK15 min
  3. Running totals and frames15 min
  4. LAG, LEAD and comparing rows14 min

Changing data

  1. INSERT13 min
  2. UPDATE13 min
  3. DELETE and TRUNCATE12 min
  4. Transactions: COMMIT and ROLLBACK14 min

Designing databases

  1. CREATE TABLE and data types15 min
  2. Constraints: NOT NULL, UNIQUE, CHECK and DEFAULT15 min
  3. Primary and foreign keys16 min
  4. ALTER TABLE and DROP TABLE15 min
  5. Normalization and good design16 min
  6. Indexes and speed16 min
  7. Views14 min

Practice

  1. Ten common SQL mistakes16 min
  2. Project: a company report25 min