End.
原
Mysql判断表字段是否存在;MySQL判断数据表是否存在
1、判断表字段是否存在
根据系统表 information_schema.columns
select count(*) from information_schema.columns
where
table_name = 'user_power_back'
and
column_name = 'user_id';
还可以加强判断为哪个数据库的表字段
SELECT count(*) from information_schema.columns WHERE table_name = 'user_power_back' AND column_name = 'user_id'
AND table_schema='config_center';
2、判断表是否存在
根据系统表 information_schema.TABLES
SELECT * FROM information_schema.TABLES
WHERE table_name ='crontab_config' AND table_schema='config_center';
End.