当前位置:网站首页>postgresql没有nvl的解决办法,postgresql查询所有的表
postgresql没有nvl的解决办法,postgresql查询所有的表
2022-07-23 09:59:00 【胡八一】
postgresql没有nvl的解决办法
oracle 的NVL(col,0)是判断如果col字段为空的时候赋值0。
postgresql里也有类似的方法COALESCE,
COALESCE函数是返回参数中的第一个非null的值,它要求参数中至少有一个是非null的,如果参数都是null会报错,如下
SELECT coalesce(collect_result,0) as collect_result FROM collect
select COALESCE(null,null); //报错
select COALESCE(null,null,now()::varchar,''); //结果会得到当前的时间
select COALESCE(null,null,'',now()::varchar); //结果会得到''
//可以和其他函数配合来实现一些复杂点的功能:查询学生姓名,如果学生名字为null或''则显示“姓名为空”
select case when coalesce(name,'') = '' then '姓名为空' else name end from student;
postgresql查询所有的表
select * from pg_tables where schemaname = '模式名' order by tablename asc;
边栏推荐
- 粒子边界碰撞的处理
- linux定时备份数据库脚本
- 基于matlab的BOC调制信号捕获仿真
- Argocd user management, RBAC control, script login, APP synchronization
- Kettle实现共享数据库连接及插入更新组件实例
- Simulation de modulation et de démodulation du signal CBOC basée sur MATLAB, sortie de corrélation, spectre de puissance et suivi de décalage de fréquence
- The pit trodden by real people tells you to avoid the 10 mistakes often made in automated testing
- 易基因|靶基因DNA甲基化测序(Target-BS)
- 面试官:生成订单30分钟未支付,则自动取消,该怎么实现?
- Mathematical function of MySQL function summary
猜你喜欢
![[interview frequency] cookies, sessions, tokens? Don't worry about being asked after reading it](/img/c0/46f2a99ef2ed0b5d4d5c77a143b160.png)
[interview frequency] cookies, sessions, tokens? Don't worry about being asked after reading it

Live classroom system 03 supplement model class and entity

152. Product maximum subarray

FastAPI应用加入Nacos

C# 线程锁和单多线程简单使用

General of MySQL_ Log log

Prometheus入门使用(三)

Kettle implémente une connexion de base de données partagée et insère une instance de composant de mise à jour

Supervisor installation and use

What methods are called behind the use of objects
随机推荐
ESP三相SVPWM控制器的simulink仿真
直播课堂系统02-搭建项目环境
Kettle implémente une connexion de base de données partagée et insère une instance de composant de mise à jour
基于simulink的双闭环矢量控制的电压型PWM整流器仿真
[untitled]
The accuracy of digital addition
MariaDB 数据库升级版本
用FFT加速特殊矩阵的矩阵向量乘运算
turbo编译码误码率性能matlab仿真
Kettle实现共享数据库连接及插入更新组件实例
[test platform development] 21. complete sending interface request and display response header information
[interview frequency] cookies, sessions, tokens? Don't worry about being asked after reading it
【无标题】测试【无标题】测试
The pit trodden by real people tells you to avoid the 10 mistakes often made in automated testing
直播课堂系统03补充-model类及实体
直播课堂系统01-数据库表设计
C# 线程锁和单多线程简单使用
Qu'est - ce que le codage par titre?
Use of KOA framework
转自玉溪信息公开:mRNA新冠疫苗、九洲马破伤风免疫球蛋白等产品有望年内上市。