如何查找没有外键的表?

How to find tables with no foreign keys?

是否有显示哪些表没有外键的查询或命令?

您可以查询信息架构:

SELECT table_schema, table_name
FROM   information_schema.tables t
WHERE  NOT EXISTS (SELECT *
                   FROM   table_constraints tc
                   WHERE  t.table_schema = tc.table_schema AND
                          t.table_name = tc.table_name AND
                          tc.constraint_type = 'FOREIGN KEY')