Creating an SQLite database
Thanks to Luna for writing the initial version of these instructions.
Instructions for GitHub Codespaces/Ubuntu
- Open your Swift Playground.
- Click the New Terminal button at the bottom of the screen
- Update your software repository by typing the following command and pressing Enter:
sudo apt update - Install SQLite with this command:
sudo apt install sqlite3 libsqlite3-dev - Create the database using this command:
sqlite3 Sources/SwiftPlayground/database.db "VACUUM;"(swappingdatabasewith a more meaningful name, if applicable) - Open the Extensions sidebar.
- Install an extention for opening SQLite databases, such as SQLite 3 Editor by yy0931.
Instructions for Windows 11 (personal device)
If you wish to develop an application that uses SQLite locally on your own Windows 11 device, follow these instructions:
- Open the Windows Terminal program.
- Install SQLite by copy-pasting the following command into the Terminal and pressing Enter:
winget install -e --id SQLite.SQLite - Install DB Browser using this command:
winget install -e --id DBBrowserForSQLite.DBBrowserForSQLite - Use DB Browser to create a new database, saving it where-ever your project files are stored.
Instructions for Windows 11 (school devices)
If you wish to develop an application that uses SQLite locally on the school computers, follow these instructions:
- Open the Windows Terminal program.
- Install Scoop by copy-pasting the following commands (all lines at once). Don’t paste these into the Terminal! Instead, right-click on the Terminal window:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope
CurrentUserInvoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
- Install SQLite using this command:
scoop install main/sqlite - Install DB Browser using these two commands:
scoop bucket add extrasscoop install extras/sqlitebrowser
Instructions for macOS
If you wish to develop an application that uses SQLite locally on macOS, follow these instructions:
- Open the Terminal app.
- If you haven’t already installed Homebrew, copy-paste the following command into the terminal and press Return:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - After Homebrew is installed, install SQLite with this command:
brew install sqlite - Install DB Browser using this command:
brew install --cask db-browser-for-sqlite - Use DB Browser to create a new database, saving it where-ever your project files are stored.