SELECT table_schema, table_name
FROM information_schema.tables tab
WHERE table_schema = '改成自己的数据库名字'
AND table_name NOT IN (
SELECT table_name
FROM information_schema.columns
WHERE table_schema = '改成自己的数据库名字'
AND column_key = 'PRI'
);
通过SQL查询从`information_schema.tables`和`information_schema.columns`获取数据库中所有表名,然后排除掉存在主键(column_key='PRI')的表,从而找出没有主键的表。
SELECT table_schema, table_name
FROM information_schema.tables tab
WHERE table_schema = '改成自己的数据库名字'
AND table_name NOT IN (
SELECT table_name
FROM information_schema.columns
WHERE table_schema = '改成自己的数据库名字'
AND column_key = 'PRI'
);
您可能感兴趣的与本文相关的镜像
Stable-Diffusion-3.5
Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率
790
293

被折叠的 条评论
为什么被折叠?