11

Our client has provided us with a file named db.schema. Now is there a command which I can use to run this file to create a .db file in sqlite3? Can I do this without having to type in all the queries mentioned in the db.schema file?

Please help! Thanks!

2 Answers 2

24

If that file contains only SQL commands in the correct format, get the sqlite3 command-line tool, and run it like this:

sqlite3 mydatabase.db < db.schema

Many SQLite administration tools also have functions to import such a file.

Sign up to request clarification or add additional context in comments.

1 Comment

For those unfortunate people stuck on Windows, can do it with powershell: Get-Content .\db.schema | sqlite3 .\mydatabase.db
0

For example, you can import db.schema into orange.db with these ways as shown below. *orange.sql is created if it doesn't exist and my answer explains it more:

sqlite3 orange.db < db.schema

Or:

sqlite3 orange.db
...
sqlite> .read db.schema

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.