欢迎来到 AI 中文社区(简称 AI 中文社),这里是学习交流 AI 人工智能技术的中文社区。 为了更好的体验,本站推荐使用 Chrome 浏览器。
全部教程·
数据库·
Sqlite
[目录]
·
SQLite Indexed By
SQLite教程
SQLite 安装
SQLite 命令
SQLite 语法
SQLite 数据类型
SQLite 创建数据库
SQLite 附加数据库
SQLite 分离数据库
SQLite 创建表
SQLite 删除表
SQLite Insert 语句
SQLite Select 语句
SQLite 运算符
SQLite 表达式
SQLite Where 子句
SQLite AND/OR 运算符
SQLite Update 语句
SQLite Delete 语句
SQLite Like 子句
SQLite Glob 子句
SQLite Limit 子句
SQLite Order By
SQLite Group By
SQLite Having 子句
SQLite Distinct 关键字
SQLite PRAGMA
SQLite 约束
SQLite Join
SQLite Unions 子句
SQLite NULL 值
SQLite 别名
SQLite 触发器
SQLite Indexed By
SQLite Alter 命令
SQLite Truncate Table
SQLite 视图
SQLite 事务
SQLite 子查询
SQLite Autoincrement
SQLite 注入
SQLite Explain
SQLite Vacuum
SQLite 日期 & 时间
SQLite 常用函数
SQLite C/C++ 接口
SQLite Java 接口
SQLite PHP 接口
SQLite Perl 接口
SQLite Python 接口
SQLite教程
SQLite 安装
SQLite 命令
SQLite 语法
SQLite 数据类型
SQLite 创建数据库
SQLite 附加数据库
SQLite 分离数据库
SQLite 创建表
SQLite 删除表
SQLite Insert 语句
SQLite Select 语句
SQLite 运算符
SQLite 表达式
SQLite Where 子句
SQLite AND/OR 运算符
SQLite Update 语句
SQLite Delete 语句
SQLite Like 子句
SQLite Glob 子句
SQLite Limit 子句
SQLite Order By
SQLite Group By
SQLite Having 子句
SQLite Distinct 关键字
SQLite PRAGMA
SQLite 约束
SQLite Join
SQLite Unions 子句
SQLite NULL 值
SQLite 别名
SQLite 触发器
SQLite Indexed By
SQLite Alter 命令
SQLite Truncate Table
SQLite 视图
SQLite 事务
SQLite 子查询
SQLite Autoincrement
SQLite 注入
SQLite Explain
SQLite Vacuum
SQLite 日期 & 时间
SQLite 常用函数
SQLite C/C++ 接口
SQLite Java 接口
SQLite PHP 接口
SQLite Perl 接口
SQLite Python 接口
SQLite Indexed By
"INDEXED BY index-name" 子句规定必须需要命名的索引来查找前面表中值。
如果索引名 index-name 不存在或不能用于查询,然后 SQLite 语句的准备失败。
"NOT INDEXED" 子句规定当访问前面的表(包括由 UNIQUE 和 PRIMARY KEY 约束创建的隐式索引)时,没有使用索引。
然而,即使指定了 "NOT INDEXED",INTEGER PRIMARY KEY 仍然可以被用于查找条目。
1. 语法
下面是 INDEXED BY 子句的语法,它可以与 DELETE、UPDATE 或 SELECT 语句一起使用:
SELECT|DELETE|UPDATE column1, column2... INDEXED BY (index_name) table_name WHERE (CONDITION);
假设有表 COMPANY,我们将创建一个索引,并用它进行 INDEXED BY 操作。
sqlite> CREATE INDEX salary_index ON COMPANY(salary); sqlite>
现在使用 INDEXED BY 子句从表 COMPANY 中选择数据,如下所示:
sqlite> SELECT * FROM COMPANY INDEXED BY salary_index WHERE salary > 5000;
下一章:SQLite Alter 命令
SQLite 的 ALTER TABLE 命令不通过执行一个完整的转储和数据的重载来修改已有的表。您可以使用 ALTER TABLE 语句重命名表,使用 ALTER TABLE 语句还可以在已有的表中添加额外 ...
AI 中文社