Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Using SQL for Complex Problems
00:00
5 left

Using SQL for Complex Problems

HardSQL · PostgreSQL

Problem

Describe a time when you used SQL to solve a complex data problem.

For this exercise, use the provided Docker organization, membership, and activity-event tables. Write a query that identifies organizations with at least two active members and two activity events during January 2025.

Output

  1. One row per qualifying organization
  2. Columns: organization_name, active_members, total_events, successful_events, failed_events, failure_rate_pct, and top_event_type
  3. Include the most frequent event type, breaking ties alphabetically
  4. Order by failure rate descending, then organization name ascending

Schema

organizations
ColumnTypeDescription
organization_idPKINTUnique organization identifier
organization_nameVARCHAR(100)Docker organization name
organization_members
ColumnTypeDescription
membership_idPKINTUnique membership record identifier
organization_idINTOrganization associated with the membership
member_idINTMember identifier
membership_statusVARCHAR(20)Current membership status
activity_events
ColumnTypeDescription
event_idPKINTUnique activity event identifier
organization_idINTOrganization associated with the event
member_idINTMember responsible for the event, when available
event_typeVARCHAR(30)Type of activity recorded
outcomeVARCHAR(20)Event outcome
event_timestampTIMESTAMPTimestamp when the event occurred
Tablesorganizationsorganization_membersactivity_events
Interviewer

Your question is Using SQL for Complex Problems. Start with the requirements and the three 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.