sql - 我想从 BigQuery 表中获取至少具有两个所需值之一的记录
问题描述
我的 BigQuery 架构假设
company_name | email | email_2 | phone | mobile |
并且表中有大约 50K 条记录。我想获取至少提到电话号码和电子邮件的记录。需要行与例如。
email phone
email mobile
email_2 phone
email_2 mobile
email email_2 phone
email email_2 phone mobile
什么是有效的代码,因为我是 SQL 和 BigQuery 的新手?
FROM Property_Dataset.pmDATA
WHERE
(email IS NOT NULL AND phone IS NOT NULL) OR
(email IS NOT NULL AND mobile IS NOT NULL) OR
(email_2 IS NOT NULL AND phone IS NOT NULL) OR
(email_2 IS NOT NULL AND mobile IS NOT NULL);
解决方案
我认为您可以使用如下的 where 子句:
select *
from Property_Dataset.pmDATA
where (email is not null or email_2 is not null) AND (phone is not null or mobile is not null)
推荐阅读
- javascript - html/css
- javascript - Firebase 9 模块化 - 如何开始
- java - 无法使用 Spring boot 创建多个 Redis Sentinel Lettuce 连接
- java - 如何为 SBT 设置 Java 版本
- git - 已设置 ssh 时在推送时使用用户名/密码
- javascript - 通过仅使用选择器的子元素来恢复元素
- python - 从数据集中消除所有高于 95% 的数据
- android - 我在我的 android studio 项目中创建了片段,但我的 PlaceholderFragment.java 文件中出现错误,如下所示。我现在该怎么办?
- angular - Angular,spring,通过HTTP上传文件被发送两次(OPTION + POST)
- javascript - Liferay 问题 - Liferay 7.1 GA