如何在Bigquery中查询数组数据

时间:2019-01-08 17:59:17

标签: google-bigquery

如何根据表名studentdb查询表的所有详细信息?

+-----------+------------+------------+
| tags.path | tags.value | gender data
+-----------+------------+------------+
| id/name   | Ram        | male
+-----------+------------+------------+
| id/name   | Leela      | female
+-----------+------------+------------+
| id/number | 123        |  null
+-----------+------------+------------+
| id/number | 456        |  null
+-----------+------------+------------+
| id/name   | hello      |  null
+-----------+------------+------------+     

1 个答案:

答案 0 :(得分:0)

  

我实际上想知道拉姆(Ram)这个名字出现了多少次– 3分钟前是特里(terry)

取决于表的实际架构是什么:

SELECT COUNT(*) c 
FROM `table`, UNNEST(tags) t
WHERE t.path = 'id/name' AND t.value='Ram'