查询数据库的所有表名及主键

select col.table_name,col.column_name from
information_schema.table_constraints tab,
information_schema.constraint_column_usage col
where col.constraint_name = tab.constraint_name
and col.table_name = tab.table_name
and constraint_type = 'primary key'

posted @ 2018-08-28 17:54  凤山朱德  阅读(3237)  评论(0编辑  收藏  举报