Foreign key
A foreign key protects a defined reference between records through matching key values.
Protect references to existing records
A foreign key is a database constraint for a reference to a matching key in the referenced table. In a fictional example, a service note points to an existing job. A reference value that is not NULL must not then point to an unknown job identifier.
Whether the reference may be absent is defined separately. Also clarify what should happen when the referenced record changes or is deleted. A foreign key does not automatically mean dependent data is deleted too. It protects the reference, but does not decide whether the note belongs to the job in business terms or whether the person editing may access it. Those rules need their own checks.
Sources
Related terms
- Unique keyA unique key constrains values or combinations so they cannot occur more than once within the defined data scope.
- Business ruleA business rule describes a business condition or decision that governs how an operation is handled.
- Data validationData validation checks data against defined requirements such as format, required fields or permitted value ranges.
- Legacy systemAn existing system still in use, with technical and business dependencies accumulated over time.
- Multi-tenancyMulti-tenancy supports separate customer or group scopes in one solution. A tenant is not automatically one person or one database.
- Browser cacheThe browser cache stores suitable HTTP responses for later use. Reuse and revalidation follow the applicable rules.
Articles on this topic








Software Development with ASES
Custom software, web and mobile apps


