Re: [sqlite] Help needed with query to tell a FK from a PK

2013-01-03 Thread nospam.nospam.nos...@gmail.com
On 4 January 2013 05:35, Petite Abeille wrote: > > 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.

Re: [sqlite] Help needed with query to tell a FK from a PK

2013-01-03 Thread Petite Abeille
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

Re: [sqlite] Help needed with query to tell a FK from a PK

2013-01-03 Thread danap
> Hi, > > I'm a complete sql novice so please go easy :) > > 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. Hello, I did not fully review your question detail, but perhaps this may help. The

Re: [sqlite] Help needed with query to tell a FK from a PK

2013-01-03 Thread Clemens Ladisch
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 SQLite does not give you this information. PRAGMA index_list gives you only indexes, but if the primary key is the ROWID, there is no

[sqlite] Help needed with query to tell a FK from a PK

2013-01-03 Thread nospam.nospam.nos...@gmail.com
Hi, I'm a complete sql novice so please go easy :) 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. I understand that sqlite's pragmas aren't queryable so I have some code that moves the result set