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
PR Merge Time After First Review
00:00
5 left

PR Merge Time After First Review

MediumSQL · PostgreSQL

Problem

Given a table of pull request events, write a query to find the average time it takes for a pull request to be merged after its first review.

Use the provided pull request and event data. Include only pull requests with both a valid first review and a later merge event.

Output

  1. Return one row with average_hours and reviewed_and_merged_prs.
  2. Round average_hours to two decimal places.
  3. The result should represent elapsed hours across eligible pull requests.

Schema

pull_requests
ColumnTypeDescription
pr_idPKINTUnique pull request identifier
repositoryVARCHAR(255)GitHub repository name
opened_atTIMESTAMPTime the pull request was opened
pull_request_events
ColumnTypeDescription
event_idPKINTUnique event identifier
pr_idINTPull request associated with the event
event_typeVARCHAR(50)Type of pull request event
event_atTIMESTAMPTime the event occurred
Tablespull_requestspull_request_events
Interviewer

Your question is PR Merge Time After First Review. 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.