Importance of Referential Integrity - Analytics Database - Teradata Vantage

Database Introduction

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-09-27
dita:mapPath
gtm1628096154303.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
dsm1472253642401
lifecycle
latest
Product Category
Teradata Vantageā„¢

Referential integrity prevents you from introducing errors into your database.

Suppose you have the following ORDER PART table.

Order Number Part Number Quantity
PK Not Null
FK FK
1 1 110
1 2 275
2 1 152

Part number and order number, foreign keys in the PART NUMBER table, comprise the composite primary key.

Suppose you delete the row defined by the primary key value 1 in the PART NUMBER table. The foreign key for the first and third rows in the ORDER PART table are now inconsistent, because there is no row in the PART NUMBER table with a primary key of 1. This is an example of loss of referential integrity.

Vantage provides referential integrity to prevent this from happening. If you try to delete a row from the PART NUMBER table for which you have specified referential integrity, the database management system does not allow you to remove the row if the part number is referenced in child tables.

Referential integrity does the following:
  • Ensures data integrity and consistency.
  • Increases development productivity.

    Because Vantage enforces referential integrity across all platforms, you do not need to code SQL statements to enforce referential integrity constraints or write additional programs to ensure referential integrity for updates.

  • Allows optimizations, such as join elimination.