The Primary Key Identifies each record in a relational table
Example; Imagine we have a users table that contains a record for
each student at a school or in a club. The student's unique student or members ID number Would be a good primary key as some may have the same first name or last name so they wouldn’t be a good choice as you could make mistake of identity.
A foreign key is a field in a relational table that matches the primary key column of another table.
Example
This could be a user ID as this is most likely to be in more than one table and it is the primary key in the members table this could be in a payment table this would create a relation to the 2 tables
Referential Integrity is a database concept that makes sure that relationships between tables remain consistent .When a table has a foreign key to another table, the concept of referential integrity states that you may not add a record to the table that contains the foreign key unless there is a corresponding record in the linked table.
Way too brief.
ReplyDeleteYou have not fully described each element with examples.
UPDATED
ReplyDelete