admin管理员组文章数量:1794759
postgresql 判断是空的
nullif(var1,var2)
如果var1和var2相等则返回null,如果不相等则返回var1
select nullif(1,null); 结果:1
select nullif(null,1); 结果:null
select nullif(1,1); 结果:null
select nullif(1,0); 结果:1
create table posts(
id serial primary key,
title varchar(255) not null,
excerpt varchar(255),
body text,
create_tiem timestamp default current_timestamp,
update_time timestamp
);
insert into posts(title,excerpt,body) values
(\'test post 1\',\'test post excerpt 1\',\'test post body 1\'),
(\'test post 2\',\'\',\'test post body 2\'),
(\'test post 3\', null ,\'test post body 3\');
案例1:
select id,title ,excerpt from posts;
结果:由结果得知excerpt有空值null
id title excerpt
1 test post 1 test post excerpt 1
2
本文标签: postgresql
版权声明:本文标题:postgresql 判断是空的 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686495944a73968.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论