Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Schema for Multi-Center Trials
00:00
5 left

Schema for Multi-Center Trials

HardSQL · PostgreSQL

Problem

How would you design a database schema to support a multi-center clinical trial tracking system?

Create a normalized schema for trials, centers, trial assignments, subjects, and visits, then write a query for trial 1 covering January through March 2025.

Output

  1. One row per assigned center and month, excluding no rows for centers without activity.
  2. Columns: center_name, country, month_start, new_enrollments, total_visits, completed_visits, completion_rate_pct, prior_month_enrollments, and monthly_completed_visit_rank.
  3. Sort by center_name, then month_start ascending.

Schema

trials
ColumnTypeDescription
trial_idPKINTTrial identifier
protocol_codeVARCHAR(20)Clinical protocol code
trial_nameVARCHAR(100)Trial name
phaseVARCHAR(40)Clinical trial phase
centers
ColumnTypeDescription
center_idPKINTCenter identifier
center_nameVARCHAR(100)Research center name
countryVARCHAR(60)Center country
trial_centers
ColumnTypeDescription
trial_idPKINTReferenced trial
center_idPKINTReferenced center
activation_dateDATEDate the center joined the trial
subjects
ColumnTypeDescription
subject_idPKINTSubject identifier
trial_idINTReferenced trial
center_idINTRecruiting center
subject_codeVARCHAR(30)De-identified subject code
enrollment_dateDATESubject enrollment date
visits
ColumnTypeDescription
visit_idPKINTVisit identifier
subject_idINTReferenced subject
visit_dateDATEScheduled or completed visit date
visit_statusVARCHAR(20)Visit status
Tablestrialscenterstrial_centerssubjectsvisits
Interviewer

Your question is Schema for Multi-Center Trials. Start with the requirements and the five 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.