Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
SQL for Multi-Modal Metrics
00:00
5 left

SQL for Multi-Modal Metrics

HardSQL · PostgreSQL

Problem

Write SQL queries to extract, join, and compute rolling engagement metrics across multi-modal asset catalogs and user interaction logs.

Use the provided asset, user, and interaction tables. Calculate engagement from interaction records with valid matching assets and users, using the interaction date as the reporting date.

Output

  1. One row per asset, modality, and activity date
  2. Columns: asset_id, modality, activity_date, daily_engagement, and rolling_3_day_engagement
  3. Include only matched asset and user records, order by asset_id and activity_date ascending, and preserve NULL modalities

Schema

assets
ColumnTypeDescription
asset_idPKINTUnique asset identifier
asset_nameVARCHAR(150)Display name of the asset
modalityVARCHAR(40)Asset media modality
users
ColumnTypeDescription
user_idPKINTUnique user identifier
user_nameVARCHAR(120)User display name
account_statusVARCHAR(30)Current account status
interactions
ColumnTypeDescription
interaction_idPKINTUnique interaction identifier
user_idINTUser who generated the interaction
asset_idINTAsset associated with the interaction
event_typeVARCHAR(40)Type of interaction event
occurred_atTIMESTAMPTimestamp when the interaction occurred
Tablesassetsusersinteractions
Interviewer

Your question is SQL for Multi-Modal Metrics. Start with the requirements and the three tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.