Reprinted from: http://blog.csdn.net/shunzi19860518/article/details/5932782
======================================
Export all
Sqlite3 data. DB
>. Output dd. SQL
>. Dump
Import all
Sqlite3 mydb. DB
>. Read dd. SQL
Use the official sqlite3.exe tool to operate SQLite databases.
Go to management:
Sqlite3.exe D:/test. DB // assume the data is D:/test. DB
>. Databases // display show databases of all databases and MySQL;
>. Tables // display the table of the current database and the show tables of MySQL;
>. Schment tablename; // display the table structure and the show create table tbl_name of MySQL.
>. Output C: // 1. SQL // export the SQL statement of the current database and mysqldump of MySQL
>. Dump
>. Import C: // 1. SQL // import // source for MySQL
==============================
Import
Command:. Import
SQLite>. Import file name table name
Note 1: Do not forget the Starting Point
NOTE 2: This statement cannot end with a semicolon. Non-SQL statements do not need to end with a semicolon.
NOTE 3: You need to check the default separator. It must be consistent. Otherwise, the SQLite field may be incorrectly divided.
Run the. show command to view the delimiter. If the Delimiter is inconsistent, modify it directly, for example:
SQLite>. separator ","
Convert the separator into a comma.
Example 1:
Import the data in file a.csv into Table tab_xx. (fields in a.csv are separated by commas)
SQLite>. separator ","
SQLite>. Import a.csv tab_xx
SQLite>
Import is complete.
Export
Implementation Method: redirects the output to a file.
Command:. Output
SQLite>. Output a.txt
Then, enter an SQL statement to query the data to be exported. After the query, the data is not displayed on the screen and is directly written to the file.
Enter
SQLite>. Output stdout
Redirects the output to the screen.
Example 2:
Export the data in tab_xx to the a.txt file.
SQLite>. Output a.txt
SQLite> select * From tab_xx;
SQLite>. Output stdout
Export completed.