On Jan 3, 2013, at 10:19 AM, nospam.nospam.nos...@gmail.com wrote: > I'm trying to create two queries so I can determine which of the keys > for a given sqlite3 table is the primary key and which keys are > foreign.
pragma table_info() returns a 'pk' attribute. You can use that to identify the primary keys. pragma index_list() returns a 'unique' attribute. You can use that to identify the unique keys. pragma foreign_key_list() lists, well, the foreign keys themselves. FWIW, bellow is an attempt to build an information schema [1] out of the various SQLite pragmas: http://alt.textdrive.com/svn/altdev/IMDB/Info.ddl http://alt.textdrive.com/svn/altdev/IMDB/Info.lua [1] http://en.wikipedia.org/wiki/Information_schema _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users