如何在Google BigQuery中筛选掉空值

huangapple go评论106阅读模式
英文:

How to filter out nulls in google bigquery

问题

我似乎找不到在Bigquery中像在SQL Server数据库中那样过滤掉null的方法,例如WHERE Column1 IS NOT NULL

有人可以解释一下吗?

谢谢。

英文:

I don't seem to find a way in Bigquery to filter out nulls like we do in SQL server database, e.g. WHERE Column1 IS NOT NULL.

Can anyone shed some light on this please?

Thanks.

答案1

得分: 8

你提供的语法应该可以正常工作,where 运算符在执行选择之前筛选数据集中的行。语法如下:

Select *
from table_source
where column is not NULL;

如果你想要了解更多关于 where 运算符的信息,请参考文档

此外,如果你想要替换空值,可以使用 IFNULL() 函数。语法如下:

Select *, 
       IFNULL(column, 'string_to_replace_null_value') as new_column
from table_source;

希望对你有所帮助。

英文:

The syntax you provide should work fine, the where operator filters the rows in your dataset before executing the select. The syntax is as follows:

Select *
from table_source
where column is not NULL;

If you want to read more about the where operator, please refer to the documentation.

In addition if you want to replace the null values, you can use the IFNULL() function. The syntax would be:

Select *, 
       IFNULL(column, 'string_to_replace_null_value') as new_column
from table_source;

I hope it helps.

huangapple
  • 本文由 发表于 2020年1月3日 19:30:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/59577857.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定