Overview
SQLiteStudio is a free, open-source desktop app for working with SQLite databases. Instead of typing every command, you can create tables with a form, see and edit data in a spreadsheet-like grid, and write SQL in an editor with syntax highlighting and auto-completion. It runs on Windows, macOS, and Linux and is maintained by Paweł Salawa.
SQLiteStudio includes SQLite itself, so you don't need to install anything else first. In this guide you will install SQLiteStudio, create a database, build a table with the designer, enter data, and run SQL queries.
Requirements
- A Windows, macOS, or Linux computer.
- Internet access to download SQLiteStudio.
- Optional: the
library.dbfile from the SQLite guide, to open an existing database.
Important Notes
- Changes in the table designer and data grid are not saved until you commit them (the green check mark button). Look for it whenever you edit.
- SQLiteStudio is updated regularly. These steps were written for version 3.4; menus may differ slightly in other versions.
SQLiteStudio Installation Instructions
Choose the tab for your operating system:
Installing SQLiteStudio
Click the tab above for your operating system. All versions are free downloads from sqlitestudio.pl.
The guide covers these major tasks:
- Download SQLiteStudio.
- Install it (or extract the portable version).
- Open SQLiteStudio.
- Choose language and style on first launch.
First launch
The first time SQLiteStudio opens, it may ask you to choose a language and an interface style. Choose your preferences and click OK. The main window opens with the Databases list on the left.
Beginner Example: A Course Catalog Database
Step 1: Create a new database
- Choose Database → Add a database (or press Ctrl + O).
- Next to File, click the green plus (Create new database file) button. Choose a folder such as Documents, name the file
courses.db, and click Save. - Leave the Name as suggested and click OK.
- In the Databases panel, double-click courses to connect to it.
To open an existing file instead, such as library.db from the SQLite guide, click the folder icon next to File and browse to it.
Step 2: Create a table with the designer
- Select the courses database, then choose Structure → Create a table.
- Enter the Table name:
course. - Click the Add column button for each column below. In the column dialog, enter the name, choose the data type, and check any constraints:
Column name Data type Constraints course_idINTEGER Primary Key codeTEXT Not NULL, Unique titleTEXT Not NULL creditsINTEGER Default value: 3 - Click the green Commit structure changes check mark at the top of the designer. SQLiteStudio shows the
CREATE TABLESQL it will run; click OK.
Step 3: Enter data in the grid
- In the table window, click the Data tab.
- Click the Insert row button (green plus), then type values into the cells. Leave
course_idblank; SQLite numbers it automatically. - Add these rows:
code title credits IS 2010 Business Information Systems 3 IS 4420 Database Fundamentals 3 IS 4480 Data Warehousing 3 IS 1000 Computing Lab 1 - Click the green Commit check mark on the Data tab's toolbar to save the rows.
Step 4: Run SQL in the SQL editor
- Choose Tools → Open SQL editor (or press Alt + E).
- Make sure courses is selected in the database drop-down at the top of the editor.
- Type the following query:
SELECT code, title, credits FROM course WHERE credits = 3 ORDER BY code; - Click Execute query (the blue play button) or press F9. The three 3-credit courses appear in the results grid below.
- Try a summary query:
SELECT COUNT(*) AS course_count, SUM(credits) AS total_credits FROM course;It returns 4 courses and 10 total credits.
Step 5: Export the results
Right-click the results grid (or choose Tools → Export) to export a table or query result to a format such as CSV, HTML, JSON, or SQL. Follow the export wizard and choose a file name.
Common Problems
- My changes disappeared: you closed the table without clicking the green Commit check mark.
- UNIQUE constraint failed: two rows have the same
code. Change one of them. - The query runs against the wrong database: check the database drop-down at the top of the SQL editor.
Next Steps
- Add a second table, such as
section, with a Foreign Key constraint linking it tocourse. - Learn the same tasks at the command line with the SQLite guide.
- Read the SQLiteStudio user manual.
- SQLiteStudio is a free graphical tool for SQLite database files and includes SQLite itself.
- Add a database (new or existing file), then connect to it in the Databases panel.
- Click the green Commit check mark to save changes in the designer and data grid.
- Use the SQL editor (Alt + E, run with F9) to practice writing SQL.