A platform lead at an insurer runs the nightly integrity checks on the policy database. Every foreign key resolves. Every primary key is present and unique. Then Finance asks why the renewal report counts 40,000 more customers than the ledger does, and the database has nothing to say. The data quality vs data integrity question starts there. The tables are intact. Whether they are right is a different test, against something the database never held.
Data integrity is whether the data is intact: stored, typed, and linked as the schema says, and changed only by someone allowed to change it. Data quality is whether the data is right for the use it is put to, scored on the six dimensions DAMA UK published in 2013. The first is enforced by constraints in the database. The second is scored by rules in a quality tool. Both are tests on values. Neither says what the values mean.
Integrity asks whether the record survived intact. Quality asks whether the record is right. A foreign key proves that an order points at a row in the customers table. It proves nothing about whether that row is a customer as Finance defines one. That third test, the integrity of a definition across databases, has one standard, and it runs outside both tools.
The difference is the question, the unit, and the verdict. Integrity is a property of the store, enforced by constraints. It holds or it is broken. Quality is a property of the data in use, scored by rules and reported as the share of records that pass. Our post What Is Data Integrity? A Comprehensive Guide for Enterprises covers integrity in full. Our post What Is Data Quality? covers the six dimensions and what each is measured against.
| Question | Data integrity | Data quality |
|---|---|---|
| What does it ask? | Is the record intact and correctly linked? | Is the record right for this use? |
| Where is it enforced? | In the schema and the storage layer, as constraints | In a quality tool or a pipeline, as rules with thresholds |
| What is it measured against? | The schema and the audit trail | A definition of the thing, usually unwritten |
Our data integrity post names the forms, and this article uses its definitions. Physical integrity "focuses on protecting the physical storage and transmission of data". Logical integrity "ensures data remains accurate and meaningful within the context of business rules and relationships", and it has three forms.
Each one is a constraint the database enforces at write time. A row that breaks it never lands. The quality tools have since copied the same checks into their rule languages, and the verdict became a score. AWS Glue's rule language, DQDL, has a ReferentialIntegrity rule that "Checks to what extent the values of a set of columns in the primary dataset are a subset of the values of a set of columns in a reference dataset". Its own example passes at 90 percent: ReferentialIntegrity "zipcode" "reference.zipcode" >= 0.9 (AWS documentation, read 2026-11-26). The database rejects the orphan. The quality tool counts it. Intact is a gate. Right is a percentage.
Quality checks the values against a rule, one dimension at a time. The six dimensions in use are the ones DAMA UK published in 2013 and DAMA-DMBOK carries: completeness, uniqueness, timeliness, validity, accuracy, and consistency (DAMA UK, 2013). Three of them resemble the constraints above.
| Integrity constraint | Nearest dimension | What the constraint checks | What the dimension is measured against (DAMA UK, 2013) |
|---|---|---|---|
| Entity integrity | Uniqueness | The key is present and unique in this table | "how that thing is identified" |
| Domain integrity | Validity | The value fits the column's type, range, or format | "the syntax (format, type, range) of its definition" |
| Referential integrity | Consistency | The key exists in the referenced table | "a definition", when "comparing two or more representations of a thing" |
The constraint checks the value against the schema. The dimension is measured against a definition of the thing. DAMA UK's paper says the dimensions measure quality "as opposed to defining what the data itself means or represents" (DAMA UK, 2013). So quality assumes something integrity never held: a statement of what the record is. Our post Data Quality Dimensions: The Six, and the One They All Assume takes each dimension to the definition it presupposes.
Yes, in both directions.
| Case | Integrity | Quality | Caught by |
|---|---|---|---|
| An order whose customer id points at a deleted customer | Broken | Fails consistency | A foreign key at write time, or a referential rule afterwards |
| An address the customer left in 2019, stored perfectly | Intact | Fails accuracy | A reference-data match. No constraint can see it |
| Finance's customers and Sales' customers, both intact, both passing, two different things under one name | Intact | Passes all six | Nothing in either tool |
The last row is the one this article is about. Both tables are intact. Both pass. An AI agent asked for revenue per customer sees two green scores, joins the tables on an id, and returns a number nobody can defend. The definition was never tested, because nobody wrote one a machine could test. Our post Data Quality for AI Agents: The Dimension No Profiler Measures covers what a passing score tells an agent and what it leaves out. Our post Data Quality Rules: Examples, and Why the Rule Has to Travel writes that last row in six rule languages.
Every page that holds this query draws the same line. Each is quoted as what its publisher writes.
Both are right about the first difference. None asks the next one. A foreign key proves the id exists in the customers table. Whether that table and the accounts table in the next system hold the same kind of thing is a question about the definition, and the key has no field for it. Referential integrity inside one database and the integrity of a definition across databases are different checks. Only the second has a standard.
It is the test that the thing a key points at is the thing the definition says it is, in every system that holds it. A database cannot run it, because the definition lives outside the schema. A quality tool cannot run it, because its rules are booleans on columns. Every tool can score the values. None of them can say what the column means. The one rule language built for this test is SHACL, the W3C Shapes Constraint Language, "a language for validating RDF graphs against a set of conditions" (W3C Recommendation, 20 July 2017). Our post What Is SHACL? explains the language. Its constraints are the three integrity forms, lifted from the table to the concept.
| Integrity form | Database constraint | SHACL constraint, in the specification's words |
|---|---|---|
| Entity | Primary key, unique and not null | sh:minCount "specifies the minimum number of value nodes that satisfy the condition", on the identifier of every instance of the class |
| Domain | Column type, check constraint | sh:datatype "specifies a condition to be satisfied with regards to the datatype of each value node" |
| Referential | Foreign key to a table | sh:class: "each value node is a SHACL instance of a given type". The type is a concept in the model, with a shape of its own |
The shape below follows the specification's own example. It says a customer has at least one billed account, and that the account is an Account as the model defines one.
ex:CustomerShape
a sh:NodeShape ;
sh:targetClass ex:Customer ;
sh:property [
sh:path ex:billedAccount ;
sh:class ex:Account ;
sh:minCount 1 ;
] .Point Finance's table and Sales' table at that shape and run it. Each record conforms or fails, in both systems, against one definition. The result is itself RDF: "The validation report is the result of the validation process that reports the conformance and the set of all validation results" (W3C, 2017). So the shape can carry its approver and review date as properties of itself. Our post How to Validate an Ontology with SHACL walks through a run. Our post Metadata Quality: How to Measure It and What to Do About It does the same for the record about the data. Our post Data Product vs Data Contract: A Contract Is Not a Definition covers the link a contract leaves open for this definition, and our post What Is Data Governance for AI? covers the layer that owns it.
Your database keeps the keys. Your quality tool keeps the scores. TQ Data Foundation holds the third thing: the governed definition of the concept, on RDF, OWL, and SHACL, with a named owner, a version, and the shape that tests records against it. Every definition is validated with SHACL, a standard TopQuadrant helped author, enforced in the data as policy-as-code and validation rules. AI proposes the model and the mappings; your experts confirm them. Validated data publishes automatically. Your catalog stays, and it syncs. Everything is RDF, SKOS, OWL and SHACL, exportable in full at any time.
Run your integrity checks tonight and let them pass. Then take the busiest foreign key in the estate and ask what the referenced table holds. If the answer is a table name, the definition lives nowhere. TopQuadrant is where it lives, with the shape that tests it.