indexing - SQLite syntax to create index on a temp table? -
the syntax create table is
create [temp] table tablename(...)
so table can created in temp database using
create temp table mytable(...)
or
create table temp.mytable(...)
and resolved way refer table be
temp.mytable
which different table main.mytable.
however, syntax create index just
create index indexname on tablename (fieldname )
which not allow table name have database name prepended
so ok
create index myindex on mytable (myfield)
but not
create index myindex on temp.mytable (myfield)
how can create index on temp table (especially if there might table of same name in main database?
the database name must put on index name:
create index temp.myindex on mytable(myfield)
Comments
Post a Comment