Skip to content
Advertisement

Tag: google-bigquery

Create column with timeframe relative to other column in SQL

Suppose I have the following table t_1 where every row represents a day: How can I create the following table t2 from t1? Here val_cur is defined as the sum of values of the current timeframe (i.e. the sum of values between date_start and date_end) and val_prev is defined as the sum of values of the previous timeframe (i.e. the

A string does not contain a number

Looking for addresses in a table that does not contain a number So “Smith Street” or “James Road” etc I tried using: address_street not like ‘%[0-9]%’ but this did not work, as the results returned everything that is not literally that string. Answer For this kind of investigation with strings you can use regular expressions and the corresponding functions offered

How to change arrays into rows

There is a table in BigQuery that contains 2 REPEATED(arrays) type of columns, enterded_date and status. Table in BigQuery: Is it possible to make a query that returns rows instead? Like this: Answer Consider below approach if applied to sample data in your question – output is

Return only ALL CAPS strings in BigQuery

Pretty simple question, specific to BigQuery. I’m sure there’s a command I’m missing. I’m used to using “collate” in another query which doesn’t work here. Desired return: JOHN@EMAIL.COM,STACY@EMAIL.COM Answer Consider below If applied to sample data in your question – output is In case you want the output as a comma separated list – use below with output You can

Advertisement