How do I get a list of indexed Columns for a given Table

That is literally how you do it: all the index metadata is available through the 'sqlite_master' table. See Q7 of the SQLite FAQ: http://www.sqlite.org/faq.html#q7


Use the PRAGMA index_list(table-name); and PRAGMA index_info(index-name); extensions.

Update: PRAGMA schema.index_xinfo(index-name); will return the sort order for key columns.


Add whatever conditions you want in where clause. Fields are:

CREATE TABLE sqlite_master (
  type TEXT,
  name TEXT,
  tbl_name TEXT,
  rootpage INTEGER,
  sql TEXT
);

Pastable select...the important field to include for indexes is "sql". Will not list primary keys defined in the create table statment.

select type, name, tbl_name, sql
FROM sqlite_master
WHERE type='index'

Tags:

C#

Sqlite