实例
假设在前面的章节中您已经创建了一个数据库,并给它附加了 'test' 和 'currentDB',使用 .database 命令,我们可以看到:
sqlite>.databases seq name file --- --------------- ---------------------- 0 main /home/sqlite/testDB.db 2 test /home/sqlite/testDB.db 3 currentDB /home/sqlite/testDB.db
现在,让我们尝试把 'currentDB' 从 testDB.db 中分离出来,如下所示:
sqlite> DETACH DATABASE 'currentDB';
现在,如果检查当前附加的数据库,您会发现,testDB.db 仍与 'test' 和 'main' 保持连接。
sqlite>.databases seq name file --- --------------- ---------------------- 0 main /home/sqlite/testDB.db 2 test /home/sqlite/testDB.db