MySQL查詢資料庫中沒有主鍵的表

壹頁書發表於2017-10-18

  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. );

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29254281/viewspace-2146092/,如需轉載,請註明出處,否則將追究法律責任。

相關文章