Skip to content
Advertisement

Tag: google-bigquery

Merge statement?

I am more of beginner with sql but would like some help on which statement would be best to use for my query. So I have an app that has test data, because the score could be 90 or be 85.6 the values are in different columns – former in int.value, latter in double.value. I need to merge the two

Order count per ID and calculate time between orders in BigQuery

I am working with customer purchase data and am trying to write a query in Google BigQuery that sorts all purchases by date and adds a purchase/order count per customer (order_count). Also, I would like to calculate a time-delay (in days) between the orders of one customer (purchase_latency). My query currently looks like this: The result including “order_count” and “purchase_latency”

SQL (BigQuery) Grouping Runtime Per Day

I have the following data which I want to group into seconds per day in BigQuery. Source Table: +————–+———————+———————+ | ComputerName | StartDatetime | EndDatetime | +————–+———————+———————+ | Computer1 | 2020-06-10T21:01:28 | 2020-06-10T21:20:19 | +————–+———————+———————+ | Computer1 | 2020-06-10T22:54:01 | 2020-06-11T05:21:48 | +————–+———————+———————+ | Computer2 | 2020-06-08T09:11:54 | 2020-06-10T11:36:27 | +————–+———————+———————+ I want to be able to visualise the data

Find sum of engagement_time_msec for users who have done an event named “yt_event” in BigQuery

My table looks like this: There’s one more column named “user_pseudo_id” which is unique id for users. I want to take sum of event_params.key = ‘engagement_time_msec’ for user_pseudo_id who have done event_name = ‘yt_event’. Also, event_params.key = ‘engagement_time_msec’ is only present in two events only, i.e. event_name = ‘user_engagement’ and ‘screen_view’. I have tried subqueries like this: But I am

Advertisement