Consider a situation when you have different information bases accessible and you need to utilize any of them at a time. SQLite ATTACH DATABASE explanation is utilized to choose a specific information base, and after this order, all SQLite proclamations will be executed under the joined data set.
Following is the fundamental linguistic structure of SQLite ATTACH DATABASE explanation.
ATTACH DATABASE 'DatabaseName' As 'Alias-Name';
The above order will likewise make an information base on the off chance that the data set is now not made, else it will simply connect data set record name with intelligent data set 'False Name'.
On the off chance that you need to append a current data set testDB.db, at that point ATTACH DATABASE proclamation would be as per the following −
sqlite> ATTACH DATABASE 'testDB.db' as 'TEST';
Use SQLite .information base order to show joined data set.
sqlite> .database seq name file --- --------------- ---------------------- 0 main /home/sqlite/testDB.db 2 test /home/sqlite/testDB.db
The information base names principle and temp are held for the essential data set and data set to hold transitory tables and other brief information objects. Both of these information base names exist for each data set association and ought not be utilized for connection, else you will get the accompanying admonition message.
sqlite> ATTACH DATABASE 'testDB.db' as 'TEMP'; Error: database TEMP is already in use sqlite> ATTACH DATABASE 'testDB.db' as 'main'; Error: database TEMP is already in use