The DETACH
DATABASE command detaches and dissociates a
named database from a database connection. If the same file has
been attached multiple times, this will only detach the named
attachment. If the database is an in-memory or temporary
database, the database will be destroyed and the contents will
be lost.
You cannot detach the main or temp databases. The DETACH command will fail if issued inside a
transaction.