1

How can I create the schema (tables) by an sql script in Sqlite3? I know I can do that via sqlitebrowser, but what if I want a user on a different computer just to run my db_schema.sql to create all the tables before it run an application working with the database?

Kurama
  • 569
  • 2
  • 6
  • 14
  • Possible duplicate http://stackoverflow.com/questions/35949230/how-can-i-create-a-new-sqlite-file-and-table-at-runtime-using-fielddefs – Ilyes Dec 04 '16 at 12:44

1 Answers1

0

You can create a database file and initialize the schema with a single command from a command prompt by redirecting the input to your script file like this:

sqlite3 my_database.db < db_schema.sql

https://sqlite.org/cli.html