← 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 Query3 checks · 10 min
  • 1-2Why Not Just a Spreadsheet?4 checks · 8 min

Unit 2SELECT Deeply: Filtering with WHERE

  • 2-1WHERE: Keeping Only the Rows You Want4 checks · 12 min
  • 2-2AND, OR, IN, BETWEEN5 checks · 13 min
  • 2-3LIKE Patterns and the NULL Trap6 checks · 13 min

Unit 3Sorting and Limiting Results

  • 3-1ORDER BY: Putting Rows in Order4 checks · 11 min
  • 3-2LIMIT, OFFSET, and DISTINCT5 checks · 11 min

Unit 4Aggregation: Turning Rows into Answers

  • 4-1COUNT, SUM, AVG, MIN, MAX4 checks · 12 min
  • 4-2GROUP BY: One Answer per Group4 checks · 12 min
  • 4-3HAVING: Filtering the Groups Themselves4 checks · 9 min
  • 4-4CASE: Decisions Inside a Query4 checks · 12 min

Unit 5JOINs I: Connecting Tables

  • 5-1Two Tables and the Foreign Key4 checks · 12 min
  • 5-2INNER JOIN, Step by Step3 checks · 13 min
  • 5-3Joins Meet WHERE and GROUP BY4 checks · 11 min

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

  • 6-1LEFT JOIN: Keeping the Unmatched3 checks · 11 min
  • 6-2Joining Three Tables4 checks · 12 min
  • 6-3Self Joins: A Table Meets Itself4 checks · 10 min
  • 6-4Subqueries and WITH: A Query Inside a Query5 checks · 13 min

Unit 7Writing Data: INSERT, UPDATE, DELETE

  • 7-1INSERT, Properly4 checks · 11 min
  • 7-2UPDATE and DELETE Without Disasters4 checks · 11 min
  • 7-3Constraints: Rules the Database Enforces5 checks · 13 min

Unit 8Schema Design: Types, Keys, Relationships

  • 8-1Choosing Types and Keys4 checks · 11 min
  • 8-2One-to-Many and Many-to-Many3 checks · 12 min
  • 8-3Normalization, Gently3 checks · 11 min

Unit 9Indexes: Why Queries Are Fast or Slow

  • 9-1What an Index Really Is3 checks · 12 min
  • 9-2When Indexes Help, and When They Don't4 checks · 11 min

Unit 10Transactions and the Real World

  • 10-1Transactions and ACID in Plain Words4 checks · 13 min
  • 10-2The N+1 Problem3 checks · 10 min
  • 10-3Capstone: Query Drills5 checks · 16 min

Practice while you learn

Use Hack University's public online code editor when you want to run code online before committing to the full curriculum. The browser compilers are free for quick syntax checks, exercises, and interview practice in an isolated sandbox environment.