← Courses

CS 330 · 3 credits

Course Outline

SQL & Databases

Learn SQL and relational databases from absolute zero. You start by understanding what a table really is, then write and run real SQLite queries in every lesson: filtering with WHERE, sorting, aggregating with GROUP BY, joining tables, inserting and updating data safely, designing schemas, speeding queries up with indexes, and keeping data safe with transactions. Every concept comes with a runnable query and a your-turn exercise.

What you will learn

  • Read and write SELECT queries with WHERE, ORDER BY, LIMIT, and DISTINCT to answer real questions from data
  • Summarize data with COUNT, SUM, AVG, GROUP BY, and HAVING, and explain the difference between row filters and group filters
  • Combine tables with INNER JOIN, LEFT JOIN, multi-table joins, and self joins, and explain what a foreign key is
  • Use CASE expressions, subqueries, and WITH to compute labels and filter values inside a single query
  • Insert, update, and delete rows safely, and use constraints (PRIMARY KEY, NOT NULL, UNIQUE, CHECK) to protect data
  • Design a small schema with one-to-many and many-to-many relationships and normalize away duplicated data
  • Explain what an index is, when it speeds a query up, and what a transaction guarantees (ACID) in plain words

Course outline

Unit 1What a Database Is

  • 1-1Tables, Rows, and Your First Query10 min
  • 1-2Why Not Just a Spreadsheet?8 min

Unit 2SELECT Deeply: Filtering with WHERE

  • 2-1WHERE: Keeping Only the Rows You Want12 min
  • 2-2AND, OR, IN, BETWEEN13 min
  • 2-3LIKE Patterns and the NULL Trap13 min

Unit 3Sorting and Limiting Results

  • 3-1ORDER BY: Putting Rows in Order11 min
  • 3-2LIMIT, OFFSET, and DISTINCT11 min

Unit 4Aggregation: Turning Rows into Answers

  • 4-1COUNT, SUM, AVG, MIN, MAX12 min
  • 4-2GROUP BY: One Answer per Group12 min
  • 4-3HAVING: Filtering the Groups Themselves9 min
  • 4-4CASE: Decisions Inside a Query12 min

Unit 5JOINs I: Connecting Tables

  • 5-1Two Tables and the Foreign Key12 min
  • 5-2INNER JOIN, Step by Step13 min
  • 5-3Joins Meet WHERE and GROUP BY11 min

Unit 6JOINs II: LEFT, Multiple, and Self Joins

  • 6-1LEFT JOIN: Keeping the Unmatched11 min
  • 6-2Joining Three Tables12 min
  • 6-3Self Joins: A Table Meets Itself10 min
  • 6-4Subqueries and WITH: A Query Inside a Query13 min

Unit 7Writing Data: INSERT, UPDATE, DELETE

  • 7-1INSERT, Properly11 min
  • 7-2UPDATE and DELETE Without Disasters11 min
  • 7-3Constraints: Rules the Database Enforces13 min

Unit 8Schema Design: Types, Keys, Relationships

  • 8-1Choosing Types and Keys11 min
  • 8-2One-to-Many and Many-to-Many12 min
  • 8-3Normalization, Gently11 min

Unit 9Indexes: Why Queries Are Fast or Slow

  • 9-1What an Index Really Is12 min
  • 9-2When Indexes Help, and When They Don't11 min

Unit 10Transactions and the Real World

  • 10-1Transactions and ACID in Plain Words13 min
  • 10-2The N+1 Problem10 min
  • 10-3Capstone: Query Drills16 min

Keep a reference open

The cheatsheets are compact syntax references for the languages, frameworks, and tools this course touches. Keep one in a second tab while you read.