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
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
Build my plan
Use Window Functions
00:00
5 left

Use Window Functions

MediumSQL · PostgreSQL

Problem

Credit Karma’s Product Analytics team wants to monitor daily engagement with Credit Karma Credit Score. Write a PostgreSQL query that calculates the number of distinct active members viewing their score each day and a 3-day rolling average by state.

Requirements

  1. Join members to score_views using member_id.
  2. Include only active members in California, New York, or Texas who viewed credit_score from January 1 through January 3, 2026.
  3. Include dates with no qualifying views as zero-view days.
  4. Calculate the 3-day rolling average within each state, ordered by date.

Schema

members
ColumnTypeDescription
member_idPKINTUnique Credit Karma member identifier
stateVARCHAR(2)Two-letter member state code
membership_statusVARCHAR(20)Current membership status
score_views
ColumnTypeDescription
view_idPKINTUnique score-view event identifier
member_idINTMember associated with the event
viewed_atDATEDate on which the feature was viewed
event_typeVARCHAR(30)Product or feature viewed
Tablesmembersscore_views
Interviewer

Your question is Use Window Functions. Start with the requirements and the two 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.