SQLite Forum

Column names and aliases in expressions
Login
Note that `<tablename>` are not ambiguous due to the fact that there is a search-order for finding tables.  For a bare (unqualified) table name, the search order is as follows:

 - firstly, look in the `temp` schema  
 - secondly, look in the `main` schema  
 - thirdly, look in all other accessible schema in the order of attachment  

and when the table is found, the (first) one found is used.

THe CLI .databases command will show you what databases (schemas) are attached to the current connection.  seq=0 is *always* the main schema (the database opened when the connection was created), seq=1 is *always* the temp schema and is reserved for use by the `temp` schema at all times, even if it has not yet been created.  seq=2 and up are "other accessible schema/databases in the order of attachment".