Professional Documents
Culture Documents
Relational Integrity Constraints: Benedict Lim (Satu)
Relational Integrity Constraints: Benedict Lim (Satu)
Primary Keys
A primary key is a column (or columns) in a table that uniquely identifies the rows in that table.
Customers
CustomerNo 1 2 3 FirstName John John Paul LastName Black Thompson Thompson
Foreign Key
Foreign keys are columns that point to primary key columns. The foreign key can be used to crossCustomers reference tables.
Primary Key Orders OrderNo 1 2 3 Foreign Key CustomerN o 37 1 24 Customer No Book Genre Science Religion Arts 1 2 3 FirstName John John Paul LastName Black Thompson Thompson
CustomerNo is a foreign key that points to the primary key in the CUSTOMERS table.
Null
Null is used to indicate that a data value does not exist in the database. It is not zero or an empty string
Null is a blank
Integrity constraints
Integrity constraints are used to ensure accuracy and consistency of data in a relational database. There are many types of integrity constraints that play a role in referential integrity. Examples of it will be entity integrity , referential integrity.
Entity integrity
Entity integrity is an integrity rule which states that every table must have a primary key. Columns chosen to be the primary key should be unique and not null
Referential integrity
Referential integrity means that the foreign key in any referencing table must always refer to a valid row in the referenced table. Ensures that the relationship between two tables remains synchronized during updates and deletes.
BookNo 1
2 3
2 3