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
YoY Research Grants by Department
00:00
5 left

YoY Research Grants by Department

MediumSQL · PostgreSQL

Problem

The University of Chicago research administration team needs to monitor annual awarded research funding by department. Write a PostgreSQL query that calculates year-over-year growth for every department and fiscal year with at least one awarded grant.

Requirements

  1. Extract the calendar year from award_date and aggregate awarded grant amounts by department and year.
  2. Compare each year's total with the same department's previous calendar year using a LEFT JOIN.
  3. Return NULL for growth when no prior-year total exists or when the prior-year total is zero.
  4. Report growth as a percentage rounded to two decimal places, ordered by department and year.

Schema

departments
ColumnTypeDescription
department_idPKINTEGERUnique department identifier
department_nameVARCHAR(100)Department name
school_nameVARCHAR(100)Associated school or division
research_grants
ColumnTypeDescription
grant_idPKINTEGERUnique grant identifier
department_idINTEGERDepartment associated with the grant
award_dateDATEDate the grant was awarded
amountNUMERIC(12,2)Grant funding amount
grant_statusVARCHAR(20)Current grant status
Tablesdepartmentsresearch_grants
Interviewer

Your question is YoY Research Grants by Department. 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.