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 Group By Practice
00:00
5 left

SQL Join and Group By Practice

HardSQL · PostgreSQL

Problem

The College Board needs a monthly view of SAT performance across test centers. Write a PostgreSQL query that combines registration, student, test center, and score data to identify centers with at least two scored, confirmed registrations per month.

Requirements

  1. Use INNER JOIN operations to combine the related tables.
  2. Consider only confirmed registrations from 2025 and use the latest score report for each registration.
  3. Group results by test center and registration month, returning registered count, scored count, and average total score.
  4. Use HAVING to retain groups with at least two scored registrations.
  5. Use LAG to show the previous month's average score and the change from that month.
  6. Briefly explain when a join is preferable to a subquery, and mention how a subquery or CTE could isolate the latest score report.

Schema

students
ColumnTypeDescription
student_idPKINTStudent identifier
student_nameVARCHAR(100)Student name
school_nameVARCHAR(150)Student school
grade_levelINTCurrent grade level
registrations
ColumnTypeDescription
registration_idPKINTRegistration identifier
student_idINTRegistered student
center_idINTSelected test center
registered_atDATERegistration date
statusVARCHAR(20)Registration status
test_centers
ColumnTypeDescription
center_idPKINTTest center identifier
center_nameVARCHAR(120)Test center name
regionVARCHAR(50)Geographic region
score_reports
ColumnTypeDescription
report_idPKINTScore report identifier
registration_idINTAssociated registration
report_dateDATEScore publication date
total_scoreINTCombined SAT score
Tablesstudentsregistrationstest_centersscore_reports
Interviewer

Your question is SQL Join and Group By Practice. Start with the requirements and the four 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.