Can you really run
SELECT PIRMARY_KEY FROM SomeTable, where
PRIMARY_KEY is really a keyword which will instantly translate to SomeTable's primary key posts
I'm using Oracle database
select cc.column_name from user_cons_columns cc join user_constraints c on c.constraint_name = cc.constraint_name where c.table_name = 'MYTABLE' and c.constraint_type = 'P' order by cc.position
Read much more about these along with other helpful data dictionary sights within the Oracle Database Reference.
If you're asking "how do you evaluate which the main secret is for just about any given table", then 'desc table_name' will highlight all of the particulars you should know.
This really is database specific. The data usually resides inside a proprietary system table.
More often than not, however, the database implementation is great enough to offer you a saved procedure to fetch these details. You will find API's around that provides you with database agnostic methods for getting these details, however i suspect you're after something accessible from SQL. Publish your unique database type and I am sure someone knows.