For example, you can export the schema and data of apple.db to backup.sql with .dump shown below. *backup.sql is created if it doesn't exist and my answer explains how to import backup.sql into orange.db:
sqlite3 apple.db .dump > backup.sql
And, you can export only the schema of apple.db to backup.sql with .schema as shown below:
sqlite3 apple.db .schema > backup.sql
Moreover, you can export the schema and data of apple.db to backup.sql with the commands below. *.output creates and selects or only selects a file depending on the file existence and you must exit to close the file (e.g., .exit or .quit) otherwise the results of SQLite commands are output to the file:
sqlite3 apple.db
sqlite> .output backup.sql
sqlite> .dump
sqlite> .exit
And, you can export the schema and data of the specific tables in apple.db to backup.sql with the commands below:
sqlite3 apple.db
sqlite> .output backup.sql
sqlite> .dump person animal
sqlite> .exit
And, you can export only the schema of apple.db to backup.sql with the commands below:
sqlite3 apple.db
sqlite> .output backup.sql
sqlite> .schema
sqlite> .exit
And, you can export only the schema of the specific tables in apple.db to backup.sql with the commands below. *.schema exports the schema of only one specific table so you should run .schema multiple times if you want to export the schema of the specific multiple tables:
sqlite3 apple.db
sqlite> .output backup.sql
sqlite> .schema person
sqlite> .schema animal
sqlite> .exit
Lastly, you can export only the data of the specific tables in apple.db to backup.sql with the commands below:
sqlite3 apple.db
sqlite> .mode insert
sqlite> .output backup.sql
sqlite> SELECT * FROM person, animal;
sqlite> .exit