mysql一库多表查询主键

mysql> show databases;

mysql> use information_schema;

mysql> show tables;

mysql> select * from KEY_COLUMN_USAGE;    //查询每个库里每个表的信息

mysql> select * from KEY_COLUMN_USAGE where TABLE_SCHEMA='table_name' and CONSTRAINT_NAME='PRIMARY';  //根据条件查询需要的表格

posted on 2017-05-17 09:26  Alan丶文  阅读(523)  评论(0编辑  收藏  举报