Running SQL commands in DB Browser

Learn how to use DB Browser to interact with SQLite databases

DB Browser is a powerful tool for interacting with SQLite databases. In this article, we’ll show you how to use it to load a database file, run SQL queries, and load in a set of queries from a file.

Opening a database file.

In order to open a database file, click “Open Database” (or find it under the ‘File’ menu). Find the .sqlite file of your database and open it. From there, you can see the database schema in the “Database Structure” or manually inspect the tables in the “Browse Data” tab.

This video demonstrates opening a database file:

Writing SQL queries

DB Browser supports writing SQL queries directly under the “Execute SQL” tab. This video demonstrates running SQL queries:

Running SQL queries from a file

It can sometimes be helpful to run SQL queries from a .sql file. DB browser supports loading a file and running queries from it. By default, the results from the last query of a file will appear in the results window, but you can also run a single query at a time by selecting that line and using the “Execute current line” button: single file button

This video demonstrates loading a .sql file and running one query at a time:

Author

Codecademy Team

'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'

Meet the full team