【问题标题】:BigQuery - filtering without losing 'null' valuesBigQuery - 过滤而不丢失“空”值
【发布时间】:2015-07-07 00:44:33
【问题描述】:

我尝试过滤数据库,但不幸的是我丢失了“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"

但后来我发现只有

超级 |东南亚 | 10

null Name 值的所有行也都消失了。 我怎样才能防止他们被删除? 谢谢

【问题讨论】:

    标签: null google-bigquery contains


    【解决方案1】:

    看这个:

    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
    

    返回

    +-----+------+------+------+---+
    | Row | name | city | sold |   |
    +-----+------+------+------+---+
    |   1 | null | SFO  |   20 |   |
    |   2 | Nike | NYC  |   15 |   |
    +-----+------+------+------+---+
    

    【讨论】:

      猜你喜欢
      • 2011-06-10
      • 2021-06-17
      • 2021-07-27
      • 2012-12-16
      • 1970-01-01
      • 2013-09-28
      • 2014-09-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多