Entrepreneurship × Databases
Business lens: Entrepreneurship · Technology lens: Databases
Reading scope: Original fictional teaching. Selected documentation and same-author checks are not independent editorial validation.
Orders must remain interpretable
A fictional custom-notebook venture moves from a spreadsheet to a database. The founder expects the change to make every order correct, yet some orders still refer to missing customers or repeated order identifiers. Databases can enforce selected structural rules, but a well-formed record can contain an incorrect promise. Begin with the business entities and their relationships: customer, order, item and payment. Decide which identifiers represent distinct business objects and which values are required for a particular state. A database design should help another person interpret the venture’s obligations without relying on the founder’s memory of each sale.
Choose constraints with business owners
Sales defines when an order is accepted, Operations defines a fulfilment-ready item and Finance distinguishes payment from revenue recognition. These responsibilities inform the schema. An order identifier should not silently identify two different orders, and a customer reference should point to an appropriate existing customer record. Official PostgreSQL documentation explains uniqueness and foreign-key constraints as structural mechanisms. Their presence does not establish that the customer address is true or that the order can be fulfilled. Agree on how corrections, cancellations and disputed records are represented. Keep source evidence and avoid deleting an accepted obligation merely because its customer details are incomplete.
Worked staging-table review
The invented import contains thirty order rows. Twenty-four have distinct order identifiers and valid customer references, four have missing parent customer records and two duplicate an already represented order identifier. Initial supported structural coverage is 24/30 = 80% of raw rows. After setting aside the two duplicate rows for reconciliation, there are twenty-eight distinct candidate orders. Coverage among those candidates is 24/28 ≈ 85.71%. This denominator change does not repair the four missing customer relationships. The duplicates may reveal an import error or a legitimate updated version; investigate their source before deciding which values should populate the canonical order.
A repair needs provenance
Recover valid customer references for three of the four unresolved candidate orders. Supported candidates become twenty-seven out of twenty-eight, approximately 96.43%, with one still unresolved. Record how each relationship was established. A name match alone may join the wrong people, particularly when customers have similar names. Do not create an invented customer merely to satisfy a foreign key. An unresolved order may belong in a staging or exception process until enough evidence exists to accept it. Structural coverage is a quality measure for the stated rules, not a complete judgement of commercial validity, identity, privacy or fulfilment readiness.
Practice a constrained import
Extend the existing database-constraints lesson with a thirty-row synthetic import and a separate canonical order table. Show the twenty-four initially supported candidates, the two duplicate events and the four missing relationships. Define the structural checks, then document the three recoveries without treating the last gap as zero. Reproduce 80%, 85.71% and 96.43%. Your portfolio should include a correction log and a business explanation of an order that satisfies the schema but still has an impossible delivery date. This is a proposed extension of existing bounded practice, not a new tested migration fixture or a real customer identity-resolution exercise.
Enquiry and progressive learning
Who owns the order definition, and Whom should an analyst ask about conflicting versions? Whose customer record is referenced? What is unique, Where is the source import, and When does a record become canonical? Why does a constraint not prove truth? Which denominator excludes duplicate events? How is an unresolved relationship retained? Foundation learners identify an order and its customer. Undergraduate learners design keys and calculate structural coverage. Postgraduate learners assess staging, correction policy and the risk of forced joins. Research learners define independently checked data-quality criteria before studying venture record systems. For revision, reconstruct why twenty-seven supported orders still leave one unresolved candidate and two duplicate source rows requiring their own history.
Study questions and answers
What is supported coverage after separating duplicate rows?
24 supported orders / 28 distinct candidates ≈ 85.71%.
Marking guide: Credit 24/28=85.71% distinct candidates after duplicate separation.
What changes after three customer references are recovered?
Supported candidates become 27/28 ≈ 96.43%; one candidate remains unresolved.
Marking guide: Credit 27/28=96.43%, one unresolved after three reference recoveries.
What can a foreign key not establish?
It cannot by itself establish truthful customer details, commercial validity or feasibility of the promised service.
Marking guide: Foreign key cannot establish truthful details, commercial validity or promised-service feasibility.
Practice task
Design a synthetic staging import with explicit order keys, relationship checks and evidence-backed correction.
Practice bridge
- Design a synthetic staging import with explicit order keys, relationship checks and evidence-backed correction.
- Reproduce the worked arithmetic, change one assumption and label invented evidence separately from actual practice observations.
Boundary: Original fictional exercise connected to an existing bounded or guided lesson. No new executable fixture, external platform execution or catalogue lab claimed.
Sources and further reading
- PostgreSQL constraints documentation
Scope: Selected unique and foreign-key constraint explanations checked; not a full database or migration audit.
Access: Free public official documentation