SQL
Examples
Attach the database `file.db` with the alias inferred from the name (` file`):  
```sql
ATTACH 'file.db';
```  
Attach the database `file.db` with an explicit alias (` file_db`):  
```sql
ATTACH 'file.db' AS file_db;
```  
Attach the database `file.db` in read only mode:  
```sql
ATTACH 'file.db' (READ_ONLY);
```  
Attach the database `file.db` with a block size of 16KB:  
```sql
ATTACH 'file.db' (BLOCK_SIZE 16384);
```  
Attach a SQLite database for reading and writing (see the [`sqlite` extension](#docs:extensions:sqlite) for more information):  
```sql
ATTACH 'sqlite_file.db' AS sqlite_db (TYPE SQLITE);
```  
Attach the database `file.db` if inferred database alias `file` does not yet exist:  
```sql
ATTACH IF NOT EXISTS 'file.db';
```  
Attach the database `file.db` if explicit database alias `file_db` does not yet exist:  
```sql
ATTACH IF NOT EXISTS 'file.db' AS file_db;
```  
Create a table in the attached database with alias `file`:  
```sql
CREATE TABLE file.new_table (i INTEGER);
```  
Detach the database with alias `file`:  
```sql
DETACH file;
```  
Show a list of all attached databases:  
```sql
SHOW DATABASES;
```  
Change the default database that is used to the database `file`:  
```sql
USE file;
```