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.
Answer: You can retrieve primary key information with the following SQL statement: SELECT cols. table_name, cols. column_name, cols.
We will be using sys. columns to get the column names in a table. It is a system table and used for maintaining column information.
USE db_name; DESCRIBE table_name; it'll give you column names with the type.
SELECT * FROM INFORMATION_SCHEMA. COLUMNS WHERE COLUMN_NAME LIKE 'PREFIX%' ORDER BY TABLE_NAME; Query: SELECT * FROM INFORMATION_SCHEMA.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With