小编给大家分享一下PostgreSQL判断字段是否存在的方法,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!
成都创新互联公司是专业的红古网站建设公司,红古接单;提供成都网站设计、成都网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行红古网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
PostgreSQL如何判断字段是否存在
方法一:
select count(*) from information_schema.columns WHERE table_schema = 'table_schema' and table_name = 'table_name' and column_name = 'column_name';
方法二:
select * from information_schema.columns WHERE table_schema = 'table_schema' and table_name = 'table_name' and column_name = 'column_name';
补充:
判断表是否存在:
select count (*) from information_schema.tables WHERE table_schema = 'table_schema' and table_name = 'table_name'; select * from information_schema.tables WHERE table_schema = 'table_schema' and table_name = 'table_name';
看完了这篇文章,相信你对PostgreSQL判断字段是否存在的方法有了一定的了解,想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款