mysql 查找没有主键(primary key)的表

    技术2022-07-12  80

    select table_schema, table_name from information_schema.tables where 1=1 and table_name not in ( select distinct table_name from information_schema.columns where 1=1 and column_key = "PRI") and table_schema not in ( 'mysql', 'information_schema', 'sys', 'performance_schema' );
    Processed: 0.023, SQL: 9