Skip to content
Advertisement

Tag: google-bigquery

Count multiple string and put the count of each string into column

I’m really a newbie in sql and bigquery. In this case I use bigquery-public-data.san_francisco_bikeshare.bikeshare_trips dataset (image 1 and 2). I want to count total of subscirber_type, ‘Subscriber’ and ‘Customer’, and their average duration_sec. So the column I want to make it consist of: start_station name | total_Subscriber | total_nonSubscriber | avg_duration_Subscriber | avg_duration_nonSubscriber I hope you guys understand my question

Using REGEXP_CONTAINS with a list of substrings

I want to know if its possible to use REGEXP_CONTAINS with a list of substrings from a column in another table. Essentially I will have one table containing a list of substrings that I want to check against and I am using those substrings against the whole set of table names in a dataset. Below is the closest approximation as

How to solve “SQL aggregate function not allowed”?

I want to get the cases per million where a table contains “Province Population” and another table “Interim” contains a column that has unique Epid_ID values. I want to divide the count of these “Epid_ID” values with the population where the data type of population is big numeric and I am using Big Query. Following is the sql query I

Ambiguous Source ID

I’m not sure what I’m doing wrong here. I tried to make an alias because it exits as an item in both tables I’m trying to join, but I keep getting an ambiguous error for sourceId. Answer try this change the alias for select depending on which table it is in Also are you purposely joining on columns from the

SQL – get an AVG from a COUNT

how you doing? I’m trying to get the average from a count. The metric is a string, so I get an error. I’ve tried some ways, but I can’t. Thanks for your help This is the code This is what I’ve unsuccessfully tried AVG (newsletter) as percentage AVG (CAST (newsletter as INT64)) as percentage COUNT(newsletter) / SUM(newsletter) I would like

How to order SQL query by largest string array sizes?

Background I’m quite new to SQL so apologies if I come off ignorant. After reading through some related threads I am still confused. I got the data from a Firestore export whose endpoint was a Google Cloud Storage bucket. I created a table from the bucket data in BigQuery. Question I want to order the query by the column that

Advertisement