繁体   English   中英

如何获取 bigquery 中每列的 null 值计数/百分比

[英]How to get the null value count/percentage for each columns in bigquery

表名 = '表头'

根据下表详细信息,Reg_nbr 没有 null 值,所以在 output 中它是 0,Reg_name 在 6 条记录中有 3 个 null 值,所以 output 是 50,Reg_code 只有 null 值,所以 883343780 是 88334371

请在查询部分提供帮助 - 在 bigquery 中

在此处输入图像描述

考虑以下方法

select 
  100 * countif(Reg_nbr is null) / count(1) as Reg_nbr,
  100 * countif(Reg_Name is null) / count(1) as Reg_Name,
  100 * countif(Reg_Code is null) / count(1) as Reg_Code
from your_table          

如果应用于您问题中的示例数据 - output 是

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM