Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Top Sellers From Meeting Graph

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

Your question is Top Sellers From Meeting Graph. 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

Deliverr's analytics team wants to identify the strongest collaboration pairs from internal meetings. Write a PostgreSQL query that returns the top three pairs of people who attended completed meetings together during January 2025.

Requirements

  1. Generate each unordered pair only once, never pairing a person with themselves.
  2. Count distinct completed meetings attended by both people, ignoring cancelled, scheduled, out-of-range, and invalid attendee rows.
  3. Return each person's name, the number of shared meetings, the date of their most recent shared meeting, and the pair's rank.
  4. Return exactly three pairs. Break ties deterministically by the first person's name and then the second person's name.
  5. Use multiple CTEs, joins, aggregation, and a window function.

Schema

people
ColumnTypeDescription
person_idPKINTUnique employee identifier
full_nameVARCHAR(100)Employee display name
teamVARCHAR(80)Employee team
meetings
ColumnTypeDescription
meeting_idPKINTUnique meeting identifier
organizer_idINTEmployee who organized the meeting
meeting_dateDATECalendar date of the meeting
statusVARCHAR(20)Meeting lifecycle status
meeting_attendees
ColumnTypeDescription
meeting_idPKINTReferenced meeting identifier
person_idPKINTReferenced attendee identifier
Tablespeoplemeetingsmeeting_attendees
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results