23 lines
448 B
SQL
23 lines
448 B
SQL
--task 1
|
|
select
|
|
user_id,
|
|
indexOf(tags, 'promo') as promo_index,
|
|
arrayJoin(tags)
|
|
from events
|
|
where has(tags, 'promo')
|
|
|
|
-- task 2
|
|
select
|
|
user_id,
|
|
scores['math'] as math_score,
|
|
mapValues(scores) as all_values
|
|
from metrics
|
|
|
|
-- task 3
|
|
select
|
|
name,
|
|
contact.type as contact_type,
|
|
contact.value as contact_value
|
|
from users_nested
|
|
array join contacts as contact
|
|
where contact.type = 'email' |