简体   繁体   English

如何获取 SQLite 数据库中表的索引列

[英]How do I get the indexed columns of a table in SQLite database

I have created an index for MyColumn column in MyTable table in a SQLite database.我在 SQLite 数据库的 MyTable 表中为 MyColumn 列创建了一个索引。

CREATE INDEX "MyIndex" ON "MyTable" ("MyColumn")

using this query I can get the list of indexes:使用此查询,我可以获得索引列表:

SELECT name 
FROM sqlite_master 
WHERE type = 'index';

----------------
MyIndex

But how do I get the list of columns associated with those indexes?但是如何获取与这些索引关联的列列表?

In my case MyIndex: MyColumn在我的情况下 MyIndex: MyColumn

My guess is you are looking for this:我的猜测是你正在寻找这个:

PRAGMA index_info('MyIndex');

You can also get the table indexes using:您还可以使用以下方法获取表索引:

PRAGMA index_list('MyTable');

More details at this excellent guide这个优秀指南的更多细节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取给定表的索引列列表 - How do I get a list of indexed Columns for a given Table 如何有效地裁剪*索引*位图并获得*索引*结果? - How do I efficiently crop an *indexed* Bitmap and get an *indexed* result? 如何使用单个表批量更新 sqlite 数据库 - How do I batch update a sqlite database with a single table 如何从类中获取Sqlite Table属性? - How do I get a Sqlite Table attribute from a Class? 如何使用SQLite.NET从现有的sqlite数据库中获取表名列表? - How can I get a list of table names from an existing sqlite database using SQLite.NET? 如何使用 SQLite 从数据库表中仅获取一个字段? - How can I get just one field from a database table with SQLite? 如何在SQLite上使用AutoIncrement将Dapper.Rainbow插入到表中? - How do I get Dapper.Rainbow to insert to a table with AutoIncrement on SQLite? 如何使用PetaPOCO(Umbraco 6,MVC)修改现有数据库表(添加/删除列) - How do I modify an existing database table (add/remove columns) with PetaPOCO (Umbraco 6, MVC) 如何使用SQlite在数据库表中设置收集对象? - How can I set the collection object in database table using SQlite? 如何使用C#获取Access数据库中的列列表? - How do I get a list of columns in an Access database using C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM