The Lawfare Academy

Lawfare Group → Knowledge Institute → Lawfare Academy

← Management Information Systems

Unit 3

Databases and integration

Learning objectives

  • Explain databases and integration in your own words.
  • Apply the principle to the worked business case.
  • Evaluate the answer and identify an assumption that could change it.

Databases and integration

Systems need shared identifiers and clear ownership of data. Integration transfers can fail, duplicate, or arrive late. Design reconciliation and error handling rather than assuming a connection guarantees consistency.

Worked example

An invoice sync retries after a timeout and creates a duplicate.

Current on-site learning

Required teaching and complete optional models are supplied on LawfareGroup.com. Publisher and primary links are optional provenance or further reading. Florida is the contemporary state-law default; federal rules and explicitly comparative material are distinguished. Independent subject review and observed human learner testing remain pending.

Work through the reasoning

Define the business workflow, data, users, system boundary, and failure consequences. For this unit, connect the explanation of databases and integration to the worked example before answering the practice question.

Check the limits

Test a representative case and identify controls, exceptions, recovery, and the accountable human owner. If the source model and the practical example use different assumptions, state the difference rather than applying the formula or rule mechanically.

Apply it independently

What control addresses the risk? Write an answer before opening the model response. Show the calculation or explain the causal or logical steps. Change one material assumption and say whether your conclusion changes. This practice is optional; you can read every part of the course without submitting work.

Extended text lesson

Continue with Make repeated, late and partial integration events explainable for the full worked case, source readings and optional progressive practice.

Complete current conceptual preparation

Make data management support a recoverable business operation

Preserve the original event case and define the management layer

The original Harbor stream E001=12000, its exact replay, E002=8000 and E003=−1000 has four received messages, three distinct accepted operations and net 19000. A conflicting reuse of E001 at 13000 is not an authorized correction. Preserve the existing tuple fingerprint, local transaction/outbox boundary and every original assessment. The relational preparation below uses a separate fictional enrollment fixture and must not be mixed with Harbor amounts or any actual Academy learner data.

Data management covers the lifecycle from collection and validation through storage, permitted use, correction, retention and authorized disposal. A data strategy links that lifecycle to a business purpose, an accountable owner, decision rules and constraints. Governance determines who can define and change those rules. Stewardship carries out the work of maintaining definitions, quality and exceptions. Database administration operates such matters as schema, access, backup and performance. One person may hold several roles, but combining roles does not erase the distinct decisions.

A DBMS supplies organized ways to define structures, store and retrieve records, enforce selected constraints and coordinate access. Its query processor interprets a request and chooses an execution strategy; storage and index components organize access to persisted data; transaction/recovery mechanisms manage committed work and recovery; catalogs record structural metadata. These mechanisms support the declared model. None can infer that a customer's authorization was real merely because an identifier exists. An application must combine database integrity with a trusted authorization and workflow boundary.

Files and spreadsheets can be appropriate for bounded tasks with controlled ownership. A DBMS becomes useful when multiple operations need shared identity, relationships, transactions and concurrent access. The cost includes administration, complexity, migration and dependence, not just a license. Replacing seven uncontrolled files with one uncontrolled database centralizes the same ambiguity. Define the record grain, units, authority and recovery expectations first.

Worked management file: separate quality dimensions

An independent fictional dispatch import has 120 rows. Four are exact retries of recognized operation identities, three have unknown customer references, and two have impossible event times. For this exercise these groups are disjoint and all other records satisfy the declared checks. There are 116 distinct intended operations after replay deduplication, of which 111 are immediately admissible and 5 need resolution. There are not 111 total business operations: rejecting or quarantining an operation from the current projection does not prove it never happened.

Report raw received count 120, exact replay count 4, unique operation count 116, accepted 111, unresolved 5, and the responsible resolution queue. A missing customer reference is a completeness/relationship issue; a contradictory time is a temporal validity issue; a replay is an operation-identity issue. A single “quality 95.7%” number, 111/116, can describe the currently admissible fraction but obscures which actions are needed. Do not use 120 as the denominator and silently count harmless retries as defective business events.

Changed fact: two of the three unknown-customer operations resolve with verified matches and unchanged amounts. Accepted rises to 113 and unresolved falls to 3; total unique operations stays 116. Preserve the matching evidence and prior state. A fuzzy name similarity alone does not establish identity. If a previously rejected event had already affected accounting, its correction requires a coordinated reconciliation rather than a second unlinked import.

From a data model to an integration contract

The conceptual model names entities and relationships independently of a product. The logical model specifies attributes, domains, keys and cardinalities. The physical model maps these to actual tables, indexes, storage and engine behavior. A service interface adds another contract: operation identity, schema/version, permitted action, authentication, response meanings, retries, concurrency and partial failure. A syntactically valid message can violate the business contract. A timed-out call is an uncertain outcome requiring reconciliation, not proof of rollback.

Use an authoritative event record plus a projection whose status is derived under an explicit versioned rule. An event's occurrence time and ingestion time belong in different fields. Keep source version and applied operation identity so that late events can be replayed under a declared policy. Rebuilding a projection should not silently send every historical customer notification again. Separate computing current state from performing external effects, and preserve evidence of effects already attempted.

Make data access appropriate to the role. A report reader may need a limited view without permission to change base records. A browser-filtered list is not a server authorization rule. An integration account should receive only the entities and operations necessary for its purpose, with monitored exceptions and revocation. This is conceptual teaching; no permissions or production records are changed by the course.

Complete optional integration model and unit assessment

Management model: a quarantine is not a disappearance

The 120 incoming rows contain four replays, 116 unique operations, 111 currently accepted and five unresolved. After two verified matches, 113 are accepted and three unresolved; 116 unique operations remain. Changed fact: one supposedly exact replay has a different amount. Treat it as a key/payload conflict, retain the original effect and investigate the changed message rather than treating it as another legitimate event or silently replacing it. Recompute the category partition from actual membership before making a new total claim.

The included complete relational studio supplies schema versus instance, functional dependencies, candidate keys, normal forms, lossless reconstruction, executable synthetic constraints and three additional full practice models. Award 0–4 points each for lifecycle/ownership, schema/dependency reasoning, integrity/authorization boundaries, exactly scoped integration/reconciliation, and a consequential changed-fact revision, for 20 points. Zero is absent, 1 merely names a topic, 2 omits an important condition, 3 is reproducible within its stated boundary, 4 additionally challenges and revises a material assumption. Do not award a content pass merely because a schema compiles or a control total balances.

Included original on-site method: relational preparation

The following previously published original Academy studio is included in full for required preparation. Its fictional enrollment dataset is independent of Harbor and the 120-row import; it accesses no actual learner records. Historical source provenance and engine boundaries remain as stated. No publisher visit is required.

# From a business model to an enforced relational schema

What a relational database represents

A relation has named attributes and rows representing facts at a declared grain. Mathematical relations are sets; practical SQL query results can contain duplicate rows unless constraints or query operations remove them. That difference matters when counting events. A domain describes permitted attribute values and meanings. An identifier determines a row within its scope; an invoice number unique only within a company needs the company in its key or a separate globally unique internal identity. A field called id does not establish either uniqueness or business authority by itself.

Distinguish the schema, the definitions and constraints, from an instance, the current stored data. A schema can allow many valid future states beyond today's three observations. A functional dependency X→Y says two valid rows agreeing on X must agree on Y. It is a domain rule, not a correlation inferred from a tiny export. A candidate key is a minimal set determining the row. A primary key selects one candidate for ordinary reference, while other genuine candidate keys need their own constraints. Adding a surrogate key does not automatically prevent duplicate business events.

The DBMS catalog stores structural metadata; the business dictionary supplies units, grain, status definitions, time basis, owner and correction rules. A logical model must also specify optional and mandatory relationships. Views can present a derived subset without duplicating all base facts; whether a view can be updated is engine- and query-dependent. A view is not automatically a permission boundary, immutable historical snapshot or materialized copy. A DBMS may provide users and role grants; an embedded SQLite file instead relies heavily on application and operating-system access controls. Name the actual enforcement layer.

Derive a normalized design

Use an independent export Enrollment(student_code, student_name, course_code, course_title, mentor_code, mentor_name, grade), with one row per student-course enrollment. This is a fictional example, not Academy learner data. Suppose student_code→student_name, course_code→course_title and mentor_code, mentor_code→mentor_name, and the pair(student_code,course_code)→grade. The pair is the enrollment key under these rules. A grade is not determined by student alone or course alone.

First normal form requires one value from the chosen domain at each attribute position rather than an uncontrolled comma-separated list of course codes. What counts as an atomic domain depends on the declared operations: an address can be stored as one display value if it is never decomposed, but region-level querying may require separate fields with explicit rules. Second normal form removes non-key attributes depending on only part of a composite candidate key. Move student_name to Students and course_title/mentor_code to Courses. Third normal form addresses transitive non-key dependencies: mentor_name belongs in Mentors, linked by mentor_code, rather than repeated on every course.

This yields Students(student_code,name), Mentors(mentor_code,name), Courses(course_code,title,mentor_code), and Enrollments(student_code,course_code,grade). Enforce the keys and appropriate references. A join reconstructs the intended facts only when keys and references preserve the stated cardinalities. A decomposition should be lossless with respect to the modeled original facts; dependency preservation means relevant rules remain enforceable without recombining everything. Those are distinct goals. Boyce–Codd normal form strengthens determinant requirements: every nontrivial functional dependency has a superkey determinant. Some designs require tradeoffs between dependency preservation and stronger normal forms. Normalization is reasoning about dependencies, not a contest to create more tables.

Worked reconstruction and update anomalies

Take rows(S 1,Ana,C 1,SQL,M 1,Lee,80),(S 2,Bo,C 1,SQL,M 1,Lee,90),(S 1,Ana,C 2,Models,M 1,Lee,70). The original has three enrollments, two students, two courses and one mentor. The sum of the three grades is 240 and their simple enrollment-weighted mean 80. The student-level means are 75 for S 1 and 90 for S 2; their equally weighted mean 82.5 answers a different question. Normalizing must retain all three keyed enrollments and their grades, not just the grand mean.

Changing mentor M 1's current name requires one Mentors update instead of three export updates. A new course can exist before any enrollment, solving an insertion anomaly. Deleting S 2's enrollment does not erase the course or mentor. But if a certificate must preserve the mentor name printed when issued, a current-name join is insufficient; add the appropriate historical snapshot or version relationship. This is the same semantic distinction as the preserved order-line transaction-price example: normalization of current master data cannot rewrite historical facts.

Make the constraints executable

In the stated SQLite dialect, the following disposable schema expresses required identities and bounded grades. Execute it only in an isolated synthetic database for study; it is not a migration for this site.

```sql PRAGMA foreign_keys = ON; CREATE TABLE students( student_code TEXT PRIMARY KEY NOT NULL, name TEXT NOT NULL ); CREATE TABLE mentors( mentor_code TEXT PRIMARY KEY NOT NULL, name TEXT NOT NULL ); CREATE TABLE courses( course_code TEXT PRIMARY KEY NOT NULL, title TEXT NOT NULL, mentor_code TEXT NOT NULL REFERENCES mentors(mentor_code) ); CREATE TABLE enrollments( student_code TEXT NOT NULL REFERENCES students(student_code), course_code TEXT NOT NULL REFERENCES courses(course_code), grade INTEGER CHECK(grade BETWEEN 0 AND 100), PRIMARY KEY(student_code,course_code) ); ```

SQLite has historical primary-key nullability exceptions, so the explicit NOT NULL text keys are intentional. A CHECK evaluating NULL is not a substitute for NOT NULL; the nullable grade here means a grade may not yet be known. Ordinary SQLite type affinity is not rigid type enforcement. A declared INTEGER may need a STRICT-table or explicit typeof/domain policy if storage class must be constrained. An integer-cent convention does not alone prove every inserted amount is an integer. Check the actual engine/version and required domain, including rounding and currency, before treating a declaration as a complete rule.

Enable foreign keys before the transaction and verify the actual connection setting. A foreign key rejects an invalid non-null parent reference when enforced; a separate NOT NULL enforces presence. It cannot prove that the referenced student or customer is the correct real-world entity. Do not use cascading deletion by convenience where historical records must survive. The preserved foreign-key application demonstrates deferred constraints, legacy violations and failed commit handling in detail and remains part of the teaching.

Changing data without changing the question

INSERT creates rows, UPDATE changes selected attributes, and DELETE removes eligible rows under the schema's rules. A missing WHERE on an UPDATE can change every row. Use a transaction, inspect the intended key set, parameterize values and verify exact postconditions. Placeholders bind data, not arbitrary table names or sort expressions; allowlist identifiers when needed. A transaction does not grant authority to update a record. A reusable application must authenticate the caller and authorize the specific entity on the trusted server boundary independently of SQL syntax safety.

For schema evolution, inventory views, triggers, indexes and foreign-key dependents; prove exact keyed facts survive rather than comparing only count and sum. A failed SQL statement may leave an active transaction whose earlier changes still need rollback. The existing migration case proves these failure paths for its isolated fixture. No part of this written exercise authorizes production deletion or alteration.

Optional progressive practice

Guided model: identify the real key

The enrollment key is(student_code,course_code), not student name or grade. S 1 can enroll in both C 1 and C 2, while C 1 has S 1 and S 2. Changed fact: repeat enrollment attempts must be retained. The original pair no longer identifies an attempt; introduce an attempt identity or a justified additional key component, and specify which attempt a report uses. Do not overwrite the prior grade merely to maintain the old key.

Independent model: reconcile after decomposition

Retain the three pairs(S 1,C 1)=80,(S 2,C 1)=90,(S 1,C 2)=70. Their total 240 and enrollment mean 80 are useful checks, but compare every keyed row and uniqueness as well. Changed fact: grades become 85,85,70. Count 3 and total 240 remain while two original facts change. A totals-only migration test would miss the corruption.

Transfer model: required grade or unknown grade

The nullable grade with a range CHECK admits an as-yet unknown grade. If the business transition to finalized requires a grade, enforce that transition rule at the appropriate trusted layer or revise the schema. Changed fact: every saved enrollment must already be graded. Add NOT NULL as part of a reviewed migration that handles existing unknown values explicitly, rather than silently replacing them with zero. Zero is a known outcome, not a missingness code.

Unit rubric: 20 points

Four points each for grain/candidate keys and dependencies; justified normalization and historical boundaries; enforced dialect-specific domains/references; exact reconstruction and migration failure tests; and changed-fact/authority reasoning. Complete model gives four relations with three preserved enrollments, total 240, mean 80 and distinct student-weighted 82.5, while retaining unknown grade semantics and rejecting unsafe identity or deletion shortcuts.

Optional source summary: SQLite CREATE TABLE was read for primary keys, nullability, type affinity and constraint behavior. This studio's schema and enrollment reconstruction are original. The existing detailed foreign-key and normalization applications are retained; publisher and official links are optional provenance, and no real learner table is accessed.

Apply the idea

An invoice sync retries after a timeout and creates a duplicate.

What control addresses the risk? Explain your reasoning, then identify one changed fact that could alter the conclusion.

Read the worked reasoning

Stable transaction IDs and duplicate-safe processing. Reliable integration must handle repeated and incomplete transfers. In an independent response, state the given facts, identify the governing relationship, work through the calculation or comparison, and distinguish the conclusion from assumptions that still need evidence.

Check understanding

What control addresses the risk?

  1. Disabling all logs
    Feedback

    This alternative overlooks the relevant mechanism. Reliable integration must handle repeated and incomplete transfers.

  2. Stable transaction IDs and duplicate-safe processing
    Feedback

    Reliable integration must handle repeated and incomplete transfers.

  3. Relying on a larger screen
    Feedback

    This alternative does not follow from the stated facts. Reliable integration must handle repeated and incomplete transfers.

Further reading

Required teaching and complete optional models are supplied on LawfareGroup.com. Publisher and primary links are optional provenance or further reading. Florida is the contemporary state-law default; federal rules and explicitly comparative material are distinguished. Independent subject review and observed human learner testing remain pending.

My learning →