C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
SQLite Attach DatabaseWhat is Attach database?Assume a condition where you have multiple databases available and you have to use only one of them at a time. That's why ATTACH DATABASE statement is used. It facilitates you to select a particular database and after using this command, all SQLite statements will be executed under the attached database. Syntax: ATTACH DATABASE 'DatabaseName' As 'Alias-Name'; Note: The above syntax will also create a database if the database is not already present, otherwise it will only attach a database file name with the logical database Alias-Name.Let's take an example. We have an existing database JTP.db. Example: ATTACH DATABASE 'JTP.db' as 'JavaTpoint'; Database is attached now you can see it by using .databases command:
Next TopicSQLite Detach Database
|