事实上,你可以参考一下整行,但不使用*
,但使用表名:
SELECT true
FROM myTable
WHERE name='myRow'
AND myTable IS NOT NULL;
的IS NOT NULL
操作上的行值返回true,如果该行的所有列不可空值。
下面的语句:
with mytable (col1, col2, col3) as (
values
(1,null,null),
(null,1,null),
(null,null,1),
(1,1,1)
)
select *
from mytable
where mytable is not null;
将返回:
col1 | col2 | col3
-----+------+-----
1 | 1 | 1
相反BTW。是不正确的。 where mytable is null
不会返回任何东西,因为行的定义不会为空(因为它不会存在)。要查找行,其中至少一个栏为空,你将需要使用where not (mytable is not null)
类似的问题在这里描述:https://dba.stackexchange.com/q/143959/1822
谢谢!你的回答非常丰富。 –