PostgreSQL如何判断字段是否存在
2023-04-18 14:24:30 时间
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教程
相关文章
- python else在循环语句执行的情况
- python类属性的概念
- python中ThreadPoolExecutor如何使用
- python scrapy.Request发送请求的方式
- 怎么删除anaconda虚拟环境
- python怎么判断一个数是几位数
- python中 *= 是什么意思
- python立方怎么表示
- python代码如何运行
- python根号如何表示
- mongodb $push 重复怎么办
- python如何导出数据到excel文件
- 怎么在anaconda中卸载环境
- IP地址的分类介绍
- python中如何输出空格?
- python如何使用def关键字
- python怎么安装第三方库
- pycharm与python的区别
- mongodb出现错误1053怎么解决
- ps中如何进行像素和厘米转换