Accurately export SQLite3 table data to SQL or CSV format
This article describes how to export only the data in the specified SQLite3 table, ignore the schema information, and generate a SQL format file that can be directly imported into the database.
Data SQL export only
Generate CSV file:
To generate a CSV file containing the data, you can use the following command:
<code>.mode csv .headers on .out file.csv select * from MyTable;</code>
This command exports the contents of the MyTable table to CSV format for easy import into various systems.
Create SQL file:
To create a SQL file that can be reinserted into another SQLite3 database, you can use the following command:
<code>.mode insert <目标表名> .out file.sql select * from MyTable;</code>
Please replace <目标表名>
with the name of the table in the new database where you want to insert data. This method allows selective transfer of data between tables.
The above is the detailed content of How Can I Selectively Dump Data from Specific SQLite3 Tables into SQL or CSV Format?. For more information, please follow other related articles on the PHP Chinese website!