Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Top Longest-Running Assays by Department
00:00
5 left

Top Longest-Running Assays by Department

MediumSQL · PostgreSQL

Problem

Given a table of experimental runs, write a query to find the top three longest-running assays per department using dense rank functions.

Use PostgreSQL and include every assay whose duration rank is 1, 2, or 3 within its department.

Output

  1. Return one row per qualifying experimental run with department, assay_name, duration_minutes, and duration_rank.
  2. Exclude runs with no recorded duration.
  3. Order by department, rank ascending, duration descending, and assay name ascending.

Schema

experimental_runs
ColumnTypeDescription
run_idPKINTUnique identifier for the experimental run
departmentVARCHAR(100)Department responsible for the assay
assay_nameVARCHAR(150)Name of the assay performed
duration_minutesINTElapsed assay duration in minutes
Tablesexperimental_runs
Interviewer

Your question is Top Longest-Running Assays by Department. Start with the requirements and the one table 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.