Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 feedbackSuccess 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
Modeling Relationships for Reporting
00:00
5 left

Modeling Relationships for Reporting

EasySQL · PostgreSQL

Problem

Can you explain your process for managing data modeling and relationships in complex reporting environments?

Use the tables below to identify the reporting entities that are fully connected through the modeled relationships. Return only entities that have a valid relationship path across all required tables, and ignore rows with NULLs in relationship keys.

Output

  1. One row per reporting entity.
  2. Columns: entity_name, model_name, relationship_status.
  3. Include only entities with complete, valid relationships across the modeled reporting path.
  4. Sort by entity_name ascending, then model_name ascending.

Schema

reporting_models
ColumnTypeDescription
model_idPKINTPrimary key for the reporting model
model_nameVARCHAR(100)Name of the reporting model
domainVARCHAR(100)Business domain covered by the model
reporting_entities
ColumnTypeDescription
entity_idPKINTPrimary key for the reporting entity
entity_nameVARCHAR(120)Entity name used in reporting
model_idINTReferenced reporting model
entity_typeVARCHAR(50)Type of entity in the reporting layer
entity_relationships
ColumnTypeDescription
relationship_idPKINTPrimary key for the relationship record
entity_idINTSource entity identifier
related_entity_idINTRelated entity identifier
relationship_typeVARCHAR(50)Type of relationship between entities
is_activeBOOLEANWhether the relationship is currently active
Tablesreporting_entitiesreporting_modelsentity_relationships
Interviewer

Your question is Modeling Relationships for Reporting. 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.