When tables are linked together, if a primary key is found inanother table, it is classed as a foreign key. Referential integrity keeps therelationships between tables that are linked consistent. For instance, if youhave two tables (booking table, payment table) and assign passenger IDs(primary keys) to both tables, referential integrity ensures all recordsbetween those two tables correspond.

If a user tries to add any records in theforeign key, it won’t work as it already contains a corresponding record. Ifyou delete any records in the booking or payment tables, because they arelinked, referential integrity will make sure to update it in the linked tables.If tables are linked, and there’s a foreign key, referential integrity does notallow the deletion of records from the primary key, only if its records are alreadybeing used in another table that it is linked to. For example, in a table thathas details of flights, you cannot delete a flight ID since its linked to othertables such as a booking table and other passengers that have booked that flight.Primary keys are unique sets of numbers that are used toidentify someone or something in a table, for example in a database, primarykeys will be given to everyone on the table so that they can all be identifiedwhen used in other tables.

For example, in retail, when you order an item atArgos, you would have to list the item number (which would be the primary key)to the staff at the till; they will then check the number to see if the item isin stock so that you are able to purchase it. Without the primary key theywould have to search a long list of names through their database just to findthe item, which could take hours, therefore by having primary keys it speeds upthe process of being able to find items in a store. When building relationshipsbetween tables, for example in a one-to-many relationship, in the primary keytable, it would contain one record that links to either many records in thetable, one or even no records in the tables it is linked to. For example, in aone-to-many relationship, if a customer has booked a flight, the primary keycontaining their record would link to a booking table, and a flight table and apayment table.

x

Hi!
I'm Katy!

Would you like to get a custom essay? How about receiving a customized one?

Check it out