Foreign key
A foreign key is a field in one table that holds the unique identifier of a record in another table, linking the two.
What it means
An invoice line, for example, carries an item ID and an invoice ID. Each of these is a foreign key pointing to the item table and the invoice table. The link stops entries that refer to non-existent items and lets the system pull the item name or rate automatically. If a foreign key is missing or wrong, reports cannot tie records together.
Example
In a hardware shop's system, a sale line stores item ID 5107 instead of typing "PVC pipe 1 inch". When the pipe's description is corrected in the item table, every old invoice shows the corrected name.
Records and checks
- Record which fields are foreign keys and the table each one points to.
- Verify that no row points to a record that has been deleted.
- The system owner checks integrity after data loads or clean-ups.
Common mistakes
- Deleting a master record that still has transactions pointing at it.
- Using names, not IDs, as links, so a spelling change breaks the connection.
Did not find your answer?Message the lamp team on WhatsApp. Ask about setup, your records, or anything we have not covered here.Ask us on WhatsApp →