首页 > IT职业 > IT图书 > 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教程
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2524/viewspace-2833913/ ,如需转载,请注明出处,否则将追究法律责任。