Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Operational Bottlenecks SQL Join
00:00
5 left

Operational Bottlenecks SQL Join

MediumSQL · PostgreSQL

Problem

Write a SQL query to join attendance, lunch service, and enrollment tables to find operational bottlenecks by school and grade at Success Academy Charter Schools.

Use active enrollment records and evaluate attendance and lunch fulfillment rates. Treat missing attendance or lunch data as an operational bottleneck.

Output

  1. One row per active school and grade.
  2. Columns: school_name, grade, enrolled_students, attendance_rate, lunch_service_rate, and bottleneck_status.
  3. Rates are percentages rounded to two decimals. Include all active school-grade combinations, order by school_name and grade ascending, and label rows as Bottleneck when either rate is below its threshold or missing.

Schema

enrollment
ColumnTypeDescription
student_idPKINTUnique student identifier
school_nameVARCHAR(100)Success Academy school name
gradeINTStudent grade level
enrollment_statusVARCHAR(20)Current enrollment status
attendance
ColumnTypeDescription
attendance_idPKINTUnique attendance record identifier
student_idINTStudent associated with the attendance record
attendance_dateDATEDate attendance was recorded
attendance_statusVARCHAR(20)Attendance status such as Present or Absent
lunch_service
ColumnTypeDescription
service_idPKINTUnique lunch service record identifier
school_nameVARCHAR(100)Success Academy school name
gradeINTGrade receiving lunch service
service_dateDATEDate of lunch service
meals_requestedINTNumber of meals requested
meals_servedINTNumber of meals served
Tablesattendancelunch_serviceenrollment
Interviewer

Your question is Operational Bottlenecks SQL Join. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.