mysql判断有没有存在某个字段的方法

小编给大家分享一下mysql判断有没有存在某个字段的方法,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!

判断表中一个字段是否存在的方法:

语法:

select count(*) from information_schema.columns where table_name = '表名' and column_name = '字段名'

sql例子:

select count(*) from information_schema.columns where table_name = 't_iov_vehicle_owner_info' and column_name = 'id'

看完了这篇文章,相信你对mysql判断有没有存在某个字段的方法有了一定的了解,想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!