This SQL query prints table name, column name and column type (Data, varchar, etc).
Table_name Column_name Data_type
SELECT T.TABLE_NAME,C.COLUMN_NAME,C.DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS C
INNER JOIN INFORMATION_SCHEMA.TABLES T ON C.TABLE_NAME = T.TABLE_NAME
AND C.TABLE_SCHEMA = T.TABLE_SCHEMA
WHERE T.TABLE_TYPE = 'BASE TABLE'
How to change it so that it also prints if this column is a part of compound primary key (see below)?
Table_name Column_Name Is_Primary(y/n) Data_Type
Update: The suggested duplicate is a far cry, because it talks about a single table. The accepted answer resolved my question.