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
SQL Join and YoY Growth
00:00
5 left

SQL Join and YoY Growth

MediumSQL · PostgreSQL

Problem

Write a SQL query to join these three tables and calculate the year-over-year growth for this metric at Brown University.

Use the supplied Brown University tables and include annual observations with a prior-year comparison when available.

Output

  1. One row per metric and reporting year
  2. Columns: metric_name, reporting_year, metric_value, prior_year_value, and yoy_growth_pct
  3. Include only annual periods and order by metric_name, then reporting_year ascending

Schema

metric_definitions
ColumnTypeDescription
metric_idPKINTUnique metric identifier
metric_nameVARCHAR(100)Display name of the Brown University metric
metric_descriptionVARCHAR(255)Optional description of the metric
reporting_periods
ColumnTypeDescription
period_idPKINTUnique reporting period identifier
reporting_yearINTCalendar year represented by the period
period_typeVARCHAR(20)Period classification, such as Annual or Term
university_metric_values
ColumnTypeDescription
metric_value_idPKINTUnique metric observation identifier
metric_idINTReferences metric_definitions.metric_id
period_idINTReferences reporting_periods.period_id
metric_valueNUMERIC(12,2)Observed value for the metric and period
Tablesuniversity_metric_valuesmetric_definitionsreporting_periods
Interviewer

Your question is SQL Join and YoY Growth. 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.