Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Modeling for Complex Requirements
00:00
5 left

Modeling for Complex Requirements

HardSQL · PostgreSQL

Problem

Can you explain how you would build a data model or Entity Relationship Diagram to support a complex business requirement?

Use the provided relational model to demonstrate how requirements, entities, and relationships can be represented and validated. Include requirements without entities and entities without relationships in the result.

Output

  1. One row per business requirement and associated entity, including requirements with no entity.
  2. Columns: requirement_name, entity_name, relationship_count, and relationship_status.
  3. Sort by requirement identifier, then entity identifier, with missing entities last.

Schema

business_requirements
ColumnTypeDescription
requirement_idPKINTUnique identifier for a business requirement
requirement_nameVARCHAR(150)Name of the business requirement
owner_teamVARCHAR(100)Team responsible for the requirement
statusVARCHAR(30)Current lifecycle status
data_entities
ColumnTypeDescription
entity_idPKINTUnique identifier for a data entity
requirement_idINTRequirement supported by the entity
entity_nameVARCHAR(100)Name of the modeled entity
entity_typeVARCHAR(40)Classification of the entity
entity_relationships
ColumnTypeDescription
relationship_idPKINTUnique identifier for an entity relationship
requirement_idINTRequirement containing the relationship
source_entity_idINTEntity from which the relationship originates
target_entity_idINTEntity referenced by the relationship
relationship_typeVARCHAR(50)Business meaning of the relationship
cardinalityVARCHAR(20)Expected relationship cardinality
Tablesbusiness_requirementsdata_entitiesentity_relationships
Interviewer

Your question is Modeling for Complex Requirements. 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.