![]() ![]() ![]() If you specify an empty file name '', the statement creates a temporary file-backed database. You can attach multiple in-memory databases at the same time with a condition that each memory database must be unique. In case you want to create a new memory database and attach it to the current database connection, you use :memory: filename. For example, to refer to the people table in the contacts database, you use the contacts.people. ![]() Once the additional database attached, you can refer to all objects in the database under the name database_name. If the database file file_name does not exist, the statement creates a new database file. The statement associates the database file file_name with the current database connection under the logical database name database_name. To attach an additional database to the current database connection, you use the ATTACH DATABASE statement as follows: ATTACH DATABASE file_name AS database_name Code language: SQL (Structured Query Language) ( sql ) Therefore, every SQLite database connection has the main database and also temp database in case you deal with temporary database objects. In addition, you can access the temporary database that holds temporary tables and other database objects via the temp database. When you connect to a database, its name is main regardless of the database file name. Introduction to the SQLite ATTACH DATABASE statement Summary: in this tutorial, you will learn how to attach additional databases to the current database connection using the SQLite ATTACH DATABASE statement. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |