...
For more information about the Scuba query language, see:
BQL syntax and usage for a description of BQL building blocks and examples of common Scuba queries in BQL.
BQL vs. SQL comparison for similarities and differences between BQL and SQL concepts.
...
Code Block |
---|
select count(*) from my_table between 2019-01-01 and 2019-01-15
|
Note that data outside of the time span can be used in a query when a query or properties used in the query have an offset or trailing window that go beyond the time span.
...
Code Block |
---|
with last_24hr_activity as Actor<user>(
count(*) over 24 hours
),
num_flow_events as Flow<user_session>(
count(*)
)
select avg(price), avg(last_24hr_activity), avg(num_flow_events) from my_table
|
In this query, scopes of the aggregations are event, actor and flow, respectively, assuming that price is an event property.
...
Code Block |
---|
with user_play_time as Actor<user>(
sum(play_time)
)
select avg(user_play_time) group by music_service
|
If a user used two different music services, A and B, for 10 hours and 50 hours, respectively, the user’s total play time (sum(play_time))
is divided into two (10 and 50) and accounts for the averages of respective groups.
...