I came up with the following query, which gives me the column names along with its data types, but does not provide me with a reference type (i.e. whether the column is primary_key or foreign_key).
select column_name, data_type,character_maximum_length,is_nullable
from information_schema.columns
where table_name ='employee';
This is the result I get:
column_name | data_type | character_maximum_length | is_nullable
-------------+-------------------+--------------------------+-------------
empno | character varying | 10 | NO
full_name | character varying | 30 | YES
city | character varying | 9 | YES
gender | character | 7 | YES
Can someone help me get the reference type ( i.e. PRIMARY_KEY and FOREIGN_KEY ) for the request?
source
share