Ed Cota
Ed Cota

Reputation: 239

New to sqlite3, how do I execute .sql code on .db3 files?

Very basic question, having a hard time finding an explanation online.

I have a file code.sql that can be run on two different databases, a.db3 and b.db3. I used sqlite a.db3 to open the database in sqlite3. How do I run code.sql on it?

Upvotes: 2

Views: 2246

Answers (3)

Skyware
Skyware

Reputation: 352

Use DB Browser for SQLite is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite.

You can download the DB Browser at SQLite https://sqlitebrowser.org/

Upvotes: 0

ravenspoint
ravenspoint

Reputation: 20472

I am guessing that you are trying to use the sqlite3 command line tool that you can dowload from the sqlite.org website.

I recomend that you use, instead, sqlitestudio http://sqlitestudio.one.pl

This has a feature to execute SQL from a file on a database:

Upvotes: 0

CL.
CL.

Reputation: 180060

Use the .read code.sql command, or call sqlite3 with the file as input: sqlite3 a.db3 < code.sql.

Upvotes: 3

Related Questions