/    /  SQLiteDB – Detach DB

SQLiteDB – Detach DB:

In SQLite, we need to use the below command to detach the database that was attached .

Note:

you cannot DETACH the main and temp Databases

Syntax:

Detach Database 'alias-name';

Example:

First let’s check the current databases we have already.

sqlite> .databases

seq  name             file                                                     

---  ---------------  ---------------------------

0    main                                                                      

2    customer         /root/custDB.db

Now try to detach the customer database.

sqlite> detach database 'customer';

Verify the databases again, if they are detached from the list it was showing

sqlite> .databases

seq  name             file                                                     

---  ---------------  ----------------------------------------------------------

0    main                                                                      

sqlite>