CodesJava

Easy learning with example program codes

Attach Database in SQLite

SQLite Attach Database
To select a particular database from multiple available databases, the SQLite ATTACH DATABASE statement is used. It allows the execution of all SQLite statements under the attached database. If the database is not already present, this statement creates the database. And in other cases, it only attaches a database with the logical database Alias.

Syntax:

ATTACH DATABASE 'DatabaseName' As 'Alias-Name';   

Example:

ATTACH DATABASE 'example.db' as 'DBExample';

Explanation:
Here example.db is an already existing database and ‘DBExample’ represents the alias_name. The database will be attached after the execution of the above query. Check the attached database using command “.databases”.

Please follow and like us:
error









Copyright © 2019 CodesJava DMCA.com Protection Status