Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Third Highest Number Query

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Third Highest Number Query. Start with the requirements and the two tables on the right.

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.

Problem

Recro's technical assessment pipeline needs to identify the third highest distinct integer score across submitted assessments. Write a PostgreSQL query that validates submitted scores against registered candidates and reports how many candidates achieved that score.

Requirements

  1. Rank non-null scores from highest to lowest using distinct-score semantics.
  2. Return the third highest distinct score, not the third row after sorting.
  3. Count candidates who achieved that score, including ties.
  4. Exclude assessment rows that do not match a registered candidate.

Schema

candidates
ColumnTypeDescription
candidate_idPKINTUnique candidate identifier
candidate_nameVARCHAR(100)Candidate's full name
application_stageVARCHAR(30)Current recruitment stage
assessment_scores
ColumnTypeDescription
assessment_idPKINTUnique assessment submission identifier
candidate_idINTCandidate associated with the submission
scoreINTInteger assessment score
Tablescandidatesassessment_scores
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results