SQLite .dump command
Overview
Let’s learn about the SQLite .dump command. We can use the .dump command to export the complete database in a text file.
Syntax
The general syntax of the .dump command is as follows:
/> sqlite3 database.db .dump > dump.sql
- database.db is the SQLite database file.
- dump.sql is the generated dump script file.
Example
Launch the SQLite command prompt and issue the command to export the database.
/> sqlite3 myDatabase.db .dump > myDBDump.sql
The above command will convert all the contents of myDatabaseDB.db database into SQLite statements and dump it into ASCII text file myDBDump.sql. We can do the restoration from the generated myDBDump.sql as follows:
/> sqlite3 myDatabase.db < myDBDump.sql
—
SQLite Tutorials
SQLite tutorials on this website:
https://www.testingdocs.com/sqlite-database-tutorials/
For more information on SQLite, visit the official website: