时间:2021-07-01 10:21:17 帮助过:17人阅读
方法2:
SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE (`TABLE_SCHEMA` = ‘database_name‘) AND (`TABLE_NAME` = ‘table_name‘) AND (`COLUMN_KEY` = ‘PRI‘);
ref: https://stackoverflow.com/questions/893874/mysql-determine-tables-primary-key-dynamically
使用sql获取primary key名称
标签:使用 ref cal mys tab 使用方法 where and primary