SQL Script into SQLite


Do you have a SQL script that you want to run against a SQLite database file? Perhaps you are loading a table into the database. Are you creating a new database and loading several tables in? Either way, I will start with a simple example here to get you going. I am using DB Browser on Windows 11.

All I need is a SQL script file that creates and loads the new table. I will create the script and store it in an sql file. I created this from a file that DB Browser exported to be sure I get the syntax correct. Here is my file.

BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "tbl_new_names" (
	"Name" TEXT,
	"Number" INTEGER
);
INSERT INTO "tbl_new_names" ("Name","Number") 
  VALUES ('Olivia',79),
 ('Janice',22),
 ('Kat',43);
COMMIT;

Run DB Browser as Administrator. Open a non-production database. In the top menu go to File > Import > Database from SQL file… Find you sql file and try to open it. You will see the following dialog box.

I clicked No because I had a database file already open.

Leave a Reply