The SQLite DETACH DATABASE statement is used to detach the alias-named database from a database connection which was previously attached by using ATTACH statement.
If the same database file has been attached with multiple aliases, then DETACH command will disconnect only given name and rest of the attachment will still continue. Main and temp databases cannot be detached.
DETACH DATABASE 'Alias-Name'
Let's take an example to demonstrate how to detach an attached alias database. Here, we have a attached database "JavaTpoint".
Detach 'JavaTpoint' from JTP.db:
DETACH DATABASE 'JavaTpoint';
Database is detached now. You can see it by using ".databases" command.