Example Queries
Provided below are sample queries to help you get started with the SV(M) Data Share.
Calculate Views for a Time Frame
VW_TITLE_FACT_DS does not include views, because views depend on the time frame selected. To calculate views, divide the minutes watched in the time frame by the maximum DURATION_TO_DATE in the same time frame.
select
t.title_name,
f.season,
sum(f.minutes_watched) as minutes_watched,
max(f.duration_to_date) as duration_to_date,
sum(f.minutes_watched) / nullif(max(f.duration_to_date), 0) as views
from
VW_TITLE_FACT_DS f
join VW_TITLE_DS t
on t.title_id = f.title_id
and t.season = f.season
where
t.title_name ilike 'Severance%'
and f.watch_date between '2025-01-17' and '2025-02-16'
group by
t.title_name,
f.seasonFind a Title by IMDb ID
External IDs are stored as arrays in the EXTERNAL_IDS object.
select
title_id,
title_name,
season
from
VW_TITLE_DS
where
array_contains('tt11280740'::variant, external_ids:imdb)Extract Platforms for a Title
PLATFORM_AVAILABILITY can be flattened to one row per platform.
select
t.title_id,
t.title_name,
t.season,
p.value:platform_id as platform_id,
p.value:platform_name::varchar as platform_name
from
VW_TITLE_DS t,
lateral flatten(input => t.platform_availability) p
where
t.title_name ilike 'Severance%'Extract a Full Cast List for a Title
select
t.title_name,
c.season,
tal.talent_name,
r.role_type,
c.character,
c.movie_cast_order
from
VW_CREDIT_DS c
join VW_TITLE_DS t
on t.title_id = c.title_id
and t.season = c.season
join VW_TALENT_DS tal
on tal.talent_id = c.talent_id
join VW_ROLE_TYPE_DS r
on r.role_id = c.role_id
where
t.title_name ilike 'Severance%'
order by
c.season,
r.role_type_order,
c.movie_cast_order nulls lastUpdated about 14 hours ago
Did this page help you?
