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
SQL for Equipment Accountability
00:00
5 left

SQL for Equipment Accountability

MediumSQL · PostgreSQL

Problem

Write a SQL query to track equipment accountability by comparing government-furnished equipment checkouts, returns, and missing items across multiple exercise dates.

Use the supplied exercise, equipment, and transaction data. Treat an item as missing when it was checked out for an exercise but has not been returned for that exercise.

Output

  1. One row per exercise date, including dates with no transactions.
  2. Columns: exercise_date, exercise_name, checked_out_count, returned_count, missing_count, and missing_equipment_codes.
  3. Show missing equipment codes as a comma-separated, alphabetically ordered string, or an empty string when none are missing.
  4. Order by exercise_date ascending.

Schema

exercises
ColumnTypeDescription
exercise_idPKINTUnique exercise identifier
exercise_nameVARCHAR(100)Exercise name
exercise_dateDATEDate of the exercise
notesTEXTOptional exercise notes
equipment
ColumnTypeDescription
equipment_idPKINTUnique equipment identifier
equipment_codeVARCHAR(30)Readable equipment accountability code
equipment_typeVARCHAR(50)Equipment category
serial_numberVARCHAR(50)Manufacturer serial number
equipment_transactions
ColumnTypeDescription
transaction_idPKINTUnique transaction identifier
exercise_idINTExercise associated with the transaction
equipment_idINTEquipment involved in the transaction
event_typeVARCHAR(20)Transaction type, such as CHECKOUT or RETURN
event_dateDATEDate of the transaction
returned_byVARCHAR(100)Person recording a return
Tablesexercisesequipmentequipment_transactions
Interviewer

Your question is SQL for Equipment Accountability. 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.