Follow the instructions in the unit "Installations: Intro to SQL with SQLite
" to install SQLite and DB Browser for SQLite
Note:
- You'll find instructions for each operating system: Windows / Mac / Linux.
- If you use Windows → for
DB Browser for SQLite, use Method 3 or Method 1.
a. Verify that "SQLite" is correctly installed:
- Run this command:
sqlite3 --version
b. Verify that "DB Browser for SQLite" is correctly installed:
- Open the application in your operating system and confirm that it launches successfully.
If you have completed the installations, you can start exploring some SQL commands, following the cheat sheet below.
For example, you can:
- Create a database & a table (see the sections 'Create a database' + 'Create a table')
- Add some data (see the section 'Insert data in a table')
- Get all the entries an a table (see the section 'Read')
If you have the time and you're up for a bigger challenge, you can try to solve the tasks below:
- Create the database file animals_db.sqlite3 by connecting to it → Run this command
sqlite3 animals_db.sqlite3(creates the file if it doesn't exist) - Create a table
animalswith columnsid,name,species,age. - Insert 3 rows of sample animal data.
- Run
.tablesto confirm the table exists. - Run
.schemaanimals to view the table structure. - Select all rows from animals.
- Select only animals older than a certain age.
- Update one animal's age.
- Delete one row.
- Add a new column (e.g. weight) using ALTER TABLE.
- Export query results to CSV using
.modecsv and.output. - Quit the session with
.quitand reconnect to confirm data persisted.