filmov
tv
New & Returning Users | SQL Interview Question #sql

Показать описание
You will be tasked with finding the new and returning daily users based on a simple dataset of datetime and users. You can see how the query is built below. #sqlinterview
with first_visit_cte as (
select
user_id,
min(datetime) as first_visit
from
user_activity
group by
user_id
)
select
from
user_activity a
join
first_visit_cte b
on
with first_visit_cte as (
select
user_id,
min(datetime) as first_visit
from
user_activity
group by
user_id
)
select
from
user_activity a
join
first_visit_cte b
on