极客小将

您现在的位置是:首页 » python编程资讯

资讯内容

PostgreSQL如何判断字段是否存在

极客小将2021-01-01-
简介PostgreSQL如何判断字段是否存在方法一:select count(*) from information_schema.columns WHERE table_schema = 'table_schema'
版权所有:https://wWw.pxcodeS.com

tER少儿编程网-Scratch_Python_教程_免费儿童编程学习平台

PostgreSQL如何判断字段是否存在tER少儿编程网-Scratch_Python_教程_免费儿童编程学习平台

方法一:
tER少儿编程网-Scratch_Python_教程_免费儿童编程学习平台

select count(*) from information_schema.columns WHERE table_schema = 'table_schema'      and table_name = 'table_name' and column_name = 'column_name';

方法二:tER少儿编程网-Scratch_Python_教程_免费儿童编程学习平台

select * from information_schema.columns WHERE table_schema = 'table_schema'      and table_name = 'table_name' and column_name = 'column_name';

补充:tER少儿编程网-Scratch_Python_教程_免费儿童编程学习平台

判断表是否存在:tER少儿编程网-Scratch_Python_教程_免费儿童编程学习平台

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教程tER少儿编程网-Scratch_Python_教程_免费儿童编程学习平台

预约试听课

已有385人预约都是免费的,你也试试吧...