The “INDEXED BY index-name” clause states that a named index is required to find the values in the previous table.
If the index name index-name does not exist or cannot be used for the query, then the preparation of the SQLite statement fails.
The “NOT INDEXED” clause states that indexes are not used when accessing previous tables, including implicit indexes created by UNIQUE and PRIMARY KEY constraints.
However, even if “NOT INDEXED” is specified, INTEGER PRIMARY KEY can still be used to find entries. The following is Suppose there is a table. Use now 1.36.1. Grammar ¶
INDEXED BY The syntax of the clause, which can be associated with DELETE 、 UPDATE Or SELECT Statement to use together:SELECT|DELETE|UPDATE column1, column2...
INDEXED BY (index_name)
table_name
WHERE (CONDITION);
1.36.2. Example ¶
COMPANY We will create an index and use it to INDEXED BY Operation.sqlite> CREATE INDEX salary_index ON COMPANY(salary);
sqlite>
INDEXED BY Clause slave table COMPANY Select the data in, as follows:sqlite> SELECT * FROM COMPANY INDEXED BY salary_index WHERE salary > 5000;