SQLite Primer

Overview #

Database stored within a single file (i.e., no server required). Makes it super easy to pass around, test, develop.

Not really suitable for true production uses:

  • Fails at multiple concurrent changes.

  • Potential security risks

  • Comparatively limited functionality.

Anyway…

Installation #

On a Mac, the Homebrew way:

brew install sqlite

Start an instance with sqlite3 newdbt.sqlite, exit with control + d or .exit at the prompt.

Create #

Schema data types can be specified, but they’re not enforced.

CREATE TABLE <table name> (
    <column name> <column type>,
    <column name> <column type>,
    ...
)