Skip to content

Lesson 16 · Python

Databases: SQL Fundamentals

Meet relational databases through SQLite: why they beat JSON files, how to create typed tables, and how to ask precise questions with SELECT, WHERE, ORDER BY, and LIMIT.

40 minintermediateData & Persistence

Prerequisites: Data Structures: Trees & Graphs

Learning objectives
By the end of this lesson, you will be able to:
  • Explain what a database gives you over a JSON file: safe concurrency, enforced integrity, and querying without loading everything
  • Create a table with CREATE TABLE and sensible column types
  • Add rows with INSERT and read them back with SELECT, WHERE, ORDER BY, and LIMIT
  • Write correct queries against NULL values with IS NULL and IS NOT NULL
  • Open and explore a SQLite database file with the sqlite3 CLI and DB Browser