Showing MYSQL table columns with key types and reference
问题 I need a query (INFORMATION_SCHEMA) which will for given schema and table name show me all table columns with following attributes (what key type it is: PK=>Primary Key, UQ=>Unique Key, FK=>Foreign Key, what is key name, and if it is Foreign Key what schema.table.column is referenced): COLUMN_NAME | DATA_TYPE | KEY_TYPE | KEY_NAME | REFERENCED ============+===========+==========+=============+======================== empid | int | PK | PRIMARY | empname | varchar | UQ | uq_empname | empactive