Use google bigquery to build histogram graph

前端 未结 7 1091
再見小時候
再見小時候 2020-12-17 22:11

How can write a query that makes histogram graph rendering easier?

For example, we have 100 million people with ages, we want to draw the histogram/buckets for age 0

相关标签:
7条回答
  • 2020-12-17 22:53

    You could also use the quantiles aggregation operator to get a quick look at the distribution of ages.

    SELECT
      quantiles(age, 10)
    FROM mytable
    

    Each row of this query would correspond to the age at that point in the list of ages. The first result is the age 1/10ths of the way through the sorted list of ages, the second is the age 2/10ths through, 3/10ths, etc.

    0 讨论(0)
提交回复
热议问题