35

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?

2 Answers 2

66

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
Sign up to request clarification or add additional context in comments.

1 Comment

Almost exactly the same as in MySQL. Thanks.
6

The following should work as well:

 echo "SELECT id, username, email FROM fos_user_user;" | sqlite3 app/data.db3

1 Comment

This is not related to question

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.