Skip to content

Instantly share code, notes, and snippets.

@sh16ma
Last active January 19, 2022 10:11
Show Gist options
  • Save sh16ma/5d39167ba5c734bbcdd606869c53f945 to your computer and use it in GitHub Desktop.
Save sh16ma/5d39167ba5c734bbcdd606869c53f945 to your computer and use it in GitHub Desktop.
#๐Ÿ”Ž #BigQuery #่ฆ็ด„็ตฑ่จˆ้‡
#standaardSQL
select
/**********************************************
* Google BigQueryใงใฎ่ฆ็ด„็ตฑ่จˆ้‡
**********************************************/
count(passenger_count) as n
, avg(passenger_count) as mean
, stddev(passenger_count) as std
, min(passenger_count) as min
, (select q from(select percentile_cont(passenger_count, 0.25) over() as q from `project.dataset.table`) group by q) as first_quartile
, (select q from(select percentile_cont(passenger_count, 0.5) over() as q from `project.dataset.table`) group by q) as median
, (select q from(select percentile_cont(passenger_count, 0.75) over() as q from `project.dataset.table`) group by q) as thrd_quartile
, max(passenger_count) as max
from
`project.dataset.table`
where
passenger_count is not null
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment