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.
ATTACH DATABASE 'DatabaseName' As 'Alias-Name';
Let's take an example. We have an existing database JTP.db.
ATTACH DATABASE 'JTP.db' as 'JavaTpoint';
Database is attached now you can see it by using .databases command: