Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Rank Candidates by Technical Domain

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

Your question is Rank Candidates by Technical Domain. Start with the requirements and the three 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

You are given candidate assessment results from the Micro1 talent platform. Write a PostgreSQL query that returns each candidate's score and rank within their specific technical domain. Use a window function so ranking resets for each domain, and sort the final output by domain name and rank. If two candidates have the same score in the same domain, break ties by earlier assessment date, then by lower candidate ID.

Schema

candidates
ColumnTypeDescription
candidate_idPKINTUnique candidate ID
candidate_nameVARCHAR(100)Candidate full name
domain_idINTTechnical domain assigned to the candidate
domains
ColumnTypeDescription
domain_idPKINTUnique domain ID
domain_nameVARCHAR(100)Technical domain name
assessments
ColumnTypeDescription
assessment_idPKINTUnique assessment record ID
candidate_idINTCandidate who took the assessment
assessment_dateDATEDate of assessment
scoreINTAssessment score
Tablescandidatesdomainsassessments
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results