Databases

Install SQLite

The tiny database that lives in a single file, with its command-line tool.

  1. Check it's already there
    Terminal
    sqlite3 --version

    macOS comes with SQLite. For the newest version, run brew install sqlite.

  2. Create a database and try it
    Terminal
    sqlite3 test.db "CREATE TABLE notes(id INTEGER PRIMARY KEY, text TEXT); INSERT INTO notes(text) VALUES ('hello'); SELECT * FROM notes;"

Check it worked

  1. Check the version
    Terminal
    sqlite3 --version
  1. Install SQLiteNeeds sudo
    Terminal · Ubuntu / Debian
    sudo apt install -y sqlite3
  2. Create a database and try it
    Terminal · Ubuntu / Debian
    sqlite3 test.db "CREATE TABLE notes(id INTEGER PRIMARY KEY, text TEXT); INSERT INTO notes(text) VALUES ('hello'); SELECT * FROM notes;"

Check it worked

  1. Check the version
    Terminal · Ubuntu / Debian
    sqlite3 --version
Undo it
  1. Uninstall SQLiteNeeds sudo
    Terminal · Ubuntu / Debian
    sudo apt remove -y sqlite3
  1. Install SQLite
    PowerShell
    winget install SQLite.SQLite

    Close and reopen PowerShell afterwards.

  2. Create a database and try it
    PowerShell
    sqlite3 test.db "CREATE TABLE notes(id INTEGER PRIMARY KEY, text TEXT); INSERT INTO notes(text) VALUES ('hello'); SELECT * FROM notes;"

Check it worked

  1. Check the version
    PowerShell
    sqlite3 --version
Undo it
  1. Uninstall SQLite
    PowerShell
    winget uninstall SQLite.SQLite