时间:2021-07-01 10:21:17 帮助过:326人阅读
SELECT
#CONCAT("truncate table ",table_name,";")
table_name
FROM
information_schema. TABLES
WHERE
table_schema = ‘scdm‘
AND TABLE_NAME NOT IN (
SELECT
table_name
FROM
information_schema.table_constraints t
JOIN information_schema.key_column_usage k USING (
constraint_name,
table_schema,
table_name
)
WHERE
t.constraint_type = ‘PRIMARY KEY‘
AND t.table_schema = ‘scdm‘
)
mysql 查看所有没有主键的表
标签:and truncate sql bsp select mysql run ati 没有