rsk82
rsk82

Reputation: 29407

how to get primary key column names for a given table?

All I know is only table name, and id value on which I want to perform query, but I do not know what is id called in that table.

Upvotes: 6

Views: 8739

Answers (1)

gnab
gnab

Reputation: 9571

You can probably lookup the column name for the primary key column(s) using the answer to a quite similar question..

sqlite> pragma table_info(...)

It should also work programmatically, if needed.

Upvotes: 6

Related Questions