Databases in Plain Words
Databases in Plain Words: What a Database Is, and Why SQLite, Tables and Rows: CREATE TABLE and INSERT.
Updated
- What a Database Is, and Why SQLite (Apprentice): A JSON file loses changes when two people save at once and has to be read whole to find one item, so an API keeps its data in a database of tables, rows and columns, and Python's built-in sqlite3 module opens a whole SQLite database stored in one file.
- Tables and Rows: CREATE TABLE and INSERT (Apprentice): CREATE TABLE IF NOT EXISTS gives each column a type and rules such as NOT NULL, DEFAULT and CHECK that refuse bad rows, and INSERT adds rows with ? placeholders, one at a time with execute or many with executemany, with lastrowid giving the new row's id.