How to import load a .sql or .csv file into SQLite?
问题 I need to dump a .sql or .csv file into SQLite (I'm using SQLite3 API). I've only found documentation for importing/loading tables, not entire databases. Right now, when I type: sqlite3prompt> .import FILENAME TABLE I get a syntax error, since it's expecting a table and not an entire DB. 回答1: To import from an SQL file use the following: sqlite> .read <filename> To import from a CSV file you will need to specify the file type and destination table: sqlite> .mode csv <table> sqlite> .import