The following query returns all the column information for columns in the specified table that participate in a FK relationship. You can modify the query to return PK information by changing the constriant_type filter. select * from information_schema.columns where table_name = <TableName> AND table_schema=<Schema>and column_name not in (SELECT Col.Column_Name from INFORMATION_SCHEMA.TABLE_CO... Tab, INFORMATION_SCHEMA.CONSTRAI... Col WHERE Col.Constraint_Name = Tab.Constraint_Name ......