Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to import data into Sqlite database in batches
How to import data into Sqlite database in batches
First, use the sqlite command.

Take windows as an example, the commands under linux are the same.

1. Install the sqlite toolkit.

First, you must install the sqlite toolkit. How to judge that it is fake? An easy way is to type sqlite3 on the command line, and the following message will appear:

This means that is installed. If it is not installed, you can Baidu it.

2. Open the database

Type: sqlite3 database at the command line, for example: sqlite3 test.db:

If you don't add any tables to the database, the database will not be established and no files will be generated on the hard disk. If the database already exists, it will be opened. As shown in the above figure, the database test.db was successfully opened.

3. Change the delimiter

As shown in the figure:

The default delimiter is |, and the change command is:. Delimiter Delimiter, and then press enter.

Step 4 enter data

Command:. Import file name table name, such as. Import G:/data/temp.txt students.

It should be noted here that by default, the character encoding of the database is UTF-8. If the Chinese characters in the database are garbled, the edited txt file can be converted into UTF-8 through UE, and then imported.

Second, use SQLite export tool.

As shown in the figure, the default encoding is selected here, the text does not need to be changed to UTF-8, and the imported data will not be garbled.