mysql判断字段是否存在的方法
更新时间:2014年01月23日 17:32:57 作者:
mysql判断字段是否存在的方法有很多,如使用desc命令、show columns 命令、describe 命令等等,感兴趣的朋友可以参考下
1. desc 命令
格式: desc tablename columnname
例子:
desc `table` `mid`
desc `table` '%abc%'
2. show columns 命令
格式: show columns from tablename like columnname
例子:
show columns from `table` like 'mid'
show columns from `table` like '%abc%'
3. describe 命令
格式: describe tablename columnname
describe 相當于 show columns from
例子:
describe `table` `mid`
describe `table` '%abc%'
格式: desc tablename columnname
例子:
desc `table` `mid`
desc `table` '%abc%'
2. show columns 命令
格式: show columns from tablename like columnname
例子:
show columns from `table` like 'mid'
show columns from `table` like '%abc%'
3. describe 命令
格式: describe tablename columnname
describe 相當于 show columns from
例子:
describe `table` `mid`
describe `table` '%abc%'
相关文章
MySQL之information_schema数据库详细讲解
这篇文章主要介绍了MySQL之information_schema数据库详细讲解,本篇文章通过简要的案例,讲解了该项技术的了解与使用,以下就是详细内容,需要的朋友可以参考下2021-08-08
最新评论