Javatpoint Logo
Javatpoint Logo

SQLite Attach Database

What 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:

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:

Sqlite Attach database 1

Database is attached now you can see it by using .databases command:

Sqlite Attach database 2





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA