Http://www.runoob.com/sqlite/sqlite-detach-database.html
Sqlitedetaching a database
SQLite's DETACH dtabase statement is used to detach and dissociate a named database from a database connection that was previously appended using the ATTACH statement. If the same database file has been appended with more than one alias, the DETACH command will only break the connection for the given name, while the remaining remains valid. You cannot detach the main or temp database.
If the database is in memory or a staging database, the database will be destroyed and the content will be lost.
Grammar
The basic syntax for SQLite's DETACH DATABASE ' alias-name ' statement is as follows:
DETACH DATABASE ' Alias-name ';
Here, ' Alias-name ' is the same alias you used to attach the database using the ATTACH statement.
Instance
Let's say you've created a database in the previous section and attached ' test ' and ' CurrentDb ' to it, using the. Database command, we can see:
SQLITE>.DATABASESSEQ name file--- --------------- ----------------------0 main / HOME/SQLITE/TESTDB.DB2 test /home/sqlite/testdb.db3 currentdb /home/sqlite/testdb.db
Now, let's try to separate the ' CurrentDb ' from the testdb.db as follows:
sqlite> DETACH DATABASE ' CurrentDb ';
Now, if you check the currently attached database, you will find that the testdb.db remains connected to ' test ' and ' main '.
SQLITE>.DATABASESSEQ name file--- --------------- ----------------------0 Main /home/sqlite/testdb.db2 Test /home/sqlite/testdb.db
SQLite uses tutorial 5 to detach a database