Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute an sql script file against an SQLite 3 database file?

Tags:

sqlite

What is an SQLite 3 (3.7.11) analogue of MySQL's

mysql -p -u username database_name < file.sql

to execute all the queries in a given SQL script file against a specified database?

like image 967
Ivan Avatar asked Aug 31 '25 10:08

Ivan


1 Answers

This should work:

[someone@somewhere ~]$ echo "select * from sometable;" > file.sql
[someone@somewhere ~]$ sqlite3 file.db < file.sql 
10/02/2012
11/01/2012
09/03/2012

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!