PostgreSQL如何判断字段是否存在[postgresql教程]
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教程
以上是 PostgreSQL如何判断字段是否存在[postgresql教程] 的全部内容, 来源链接: utcz.com/z/527520.html