Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL and Data Modeling

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

Your question is SQL and Data Modeling. 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

Describe your experience with SQL and data modeling in a professional setting.

Use the supplied relational schema to demonstrate that experience by producing a concise activity summary for active entities. Include entities without qualifying activity and classify them based on their total completed value.

Output

  1. One row per active entity, including entities without qualifying events.
  2. Return entity_name, group_name, completed_event_count, total_completed_value, latest_completed_date, and value_band.
  3. Include only completed events from 2025-01-01 through 2025-03-31. Order by total_completed_value descending, then entity_id ascending.

Schema

data_entities
ColumnTypeDescription
entity_idPKINTUnique entity identifier
entity_nameVARCHAR(100)Display name of the entity
entity_typeVARCHAR(50)Classification of the entity
is_activeBOOLEANWhether the entity is active
data_events
ColumnTypeDescription
event_idPKINTUnique event identifier
entity_idINTRelated entity identifier
event_dateDATEDate on which the event occurred
statusVARCHAR(30)Current event status
event_valueNUMERIC(12,2)Numeric value associated with the event
entity_groups
ColumnTypeDescription
group_idPKINTUnique group identifier
entity_idINTEntity assigned to the group
group_nameVARCHAR(100)Assigned group name
Tablesdata_entitiesdata_eventsentity_groups
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results