Unit 5 wrote:
It seems that you cannot create a temporary table in a
database other than "temp". In other words, the
following is an error:
% CREATE TEMP TABLE temp_db.temp_table ...
temporary table name must be unqualified
But this is not:
% CREATE TEMP TABLE temp.temp_table ...
Neither is this:
% CREATE TABLE temp_db.temp_table ...
In this last case, is the table being created as a
temporary table? Or is it a regular table?
According to the very complete docs on the webpage:
http://sqlite.org/lang_createtable.html
If the "TEMP" or "TEMPORARY" keyword occurs in between "CREATE" and
"TABLE" then the table that is created is only visible within that same
database connection and is automatically deleted when the database
connection is closed. Any indices created on a temporary table are also
temporary. Temporary tables and indices are stored in a separate file
distinct from the main database file.
If a <database-name> is specified, then the table is created in the
named database. It is an error to specify both a <database-name> and the
TEMP keyword, unless the <database-name> is "temp". If no database name
is specified, and the TEMP keyword is not present, the table is created
in the main database.
There would seem to be no reason why your last case would result in a
temporary table (although surely it would have been _much_ faster for
you to just check, rather than ask here).
HTH,
Gerry