千家信息网

MySQL查询数据库中没有主键的表

发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,select table_schema,table_name from information_schema.tableswhere (table_schema,table_name) not in(
千家信息网最后更新 2026年11月02日MySQL查询数据库中没有主键的表
  1. select table_schema,table_name from information_schema.tables
  2. where (table_schema,table_name) not in(
  3. select distinct table_schema,table_name from information_schema.columns where COLUMN_KEY='PRI'
  4. )
  5. and table_schema not in (
  6. 'sys','mysql','information_schema','performance_schema'
  7. );

0