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

后端 未结 2 1689
滥情空心
滥情空心 2020-12-24 06:00

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 SQ

相关标签:
2条回答
  • 2020-12-24 06:37

    The following should work as well:

     echo "SELECT id, username, email FROM fos_user_user;" | sqlite3 app/data.db3
    
    0 讨论(0)
  • 2020-12-24 06:41

    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
    
    0 讨论(0)
提交回复
热议问题