select name,price from odoo_sale;

select name,COALESCE(price, 0) from odoo_sale;

补充:postgresql查询某列的最大值时,对查询结果为空做默认为0的处理
实例如下:
select coalesce(max(max_grade),0) from exam_grade where examinee_id = 12345 and exam_id = 1;
上述内容就是怎么在postgresql 中将空数据设为0,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。