- 判断一个表是否存在
语法:
SELECT table_name FROM information_schema.TABLES WHERE table_name ='表名';
- 判断表中一个字段是否存在,该语句会返回1或者null
语法:
select flag from information_schema.columns where table_name = '表名' and column_name = '字段名'
3、查询某个数据是否存在,该语句会返回1或者null
select flag from us '表名' where '字段名' = '值' limit 1;