BigQuery - 在不丢失 'null' 值的情况下进行过滤
BigQuery - filtering without losing 'null' values
我尝试过滤数据库,但不幸的是我丢失了 'null' 值:
样本看起来像
Name | City | Sold
Nike | NYC | 15
null | SFO | 20
Mega | SEA | 10
null | null | 8
nike | CHI | 12
我尝试在没有 Nike 的情况下以任何方式查找数据,但是当我去寻找
Select ...
where not lower(Name) contains "nike"
但后来我只找到
Mega | SEA | 10
并且 Name 的 null 值的所有行也都消失了。
我怎样才能防止它们被删除?
谢谢
看到这个:
select * from
(select string(NULL) as name,'SFO' as city, 20 as sold),
(select 'Nike' as name,'NYC' as city, 15 as sold),
where not lower(name) contains 'nike2' or name is null
returns
+-----+------+------+------+---+
| Row | name | city | sold | |
+-----+------+------+------+---+
| 1 | null | SFO | 20 | |
| 2 | Nike | NYC | 15 | |
+-----+------+------+------+---+
我尝试过滤数据库,但不幸的是我丢失了 'null' 值:
样本看起来像
Name | City | Sold
Nike | NYC | 15
null | SFO | 20
Mega | SEA | 10
null | null | 8
nike | CHI | 12
我尝试在没有 Nike 的情况下以任何方式查找数据,但是当我去寻找
Select ...
where not lower(Name) contains "nike"
但后来我只找到
Mega | SEA | 10
并且 Name 的 null 值的所有行也都消失了。 我怎样才能防止它们被删除? 谢谢
看到这个:
select * from
(select string(NULL) as name,'SFO' as city, 20 as sold),
(select 'Nike' as name,'NYC' as city, 15 as sold),
where not lower(name) contains 'nike2' or name is null
returns
+-----+------+------+------+---+
| Row | name | city | sold | |
+-----+------+------+------+---+
| 1 | null | SFO | 20 | |
| 2 | Nike | NYC | 15 | |
+-----+------+------+------+---+