Sqlite
The `sqlite3` module provides a lightweight disk-based database that does not require a separate server process. It is perfect for embedded data storage and prototyping. The guide walks through Connecting to Database, Creating Tables, Inserting & Querying, Parameterized Queries, Committing & Error Handling. `sqlite3.connect("database.db")` opens or creates a database file. Use `:memory:` for an in-memory database. The connection object provides `.cursor()` to create a cursor for executing SQL statements. Execute `CREATE TABLE` statements via `cursor.execute()`. Common column types: `INTEGER`, `REAL`, `TEXT`, `BLOB`. Add `PRIMARY KEY`, `NOT NULL`, `DEFAULT` constraints. Use `IF NOT EXISTS` to avoid errors on duplicate creation. Use `cursor.execute("INSERT INTO table VALUES (?, ?)", (val1, val2))` with parameter placeholders. Query with `SELECT`, then use `fetchone()` for a single row, `fetchall()` for all rows, or iterate directly over the cursor. The guide is organized into 5 sections that build on each other, each pairing a prose explanation with runnable code.