HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The SQLiteDETACH DTABASE statement is used to name the database from a separate database connection and freed before the connection is using the ATTACH statement added.If the same database file has been attached on a plurality of aliases, DETACH command will only disconnect the given name of the connection, while the rest is still valid. You can not separatemain or tempdatabase.
If the database is in memory or in a temporary database, the database will be destroyed, and the contents will be lost.
The SQLite DETACH DATABASE 'Alias-Name' basic syntax statement is as follows:
DETACH DATABASE 'Alias-Name';
Here, 'Alias-Name' when you have been using the same ATTACH statement to attach a database used by the alias.
Suppose in the previous chapters, you have created a database, and attach it to the 'test' and 'currentDB', use .database command, we can see:
sqlite> .databases seq name file --- --------------- ---------------------- 0 main /home/sqlite/testDB.db 2 test /home/sqlite/testDB.db 3 currentDB /home/sqlite/testDB.db
Now, let's try to 'currentDB' separated from testDB.db as follows:
sqlite> DETACH DATABASE 'currentDB';
Now, if the additional checks the current database, you will find, testDB.db still with 'test' and the 'main' stay connected.
sqlite> .databases seq name file --- --------------- ---------------------- 0 main /home/sqlite/testDB.db 2 test /home/sqlite/testDB.db