🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Databases Beginner

What is Foreign Key?

A column that creates a link between two tables by referencing the primary key of another table.

Foreign keys enforce referential integrity — ensuring relationships between tables remain consistent. For example, an orders table might have a customer_id foreign key referencing the customers table.

Foreign key constraints can specify behavior on delete/update: CASCADE (propagate changes), SET NULL, SET DEFAULT, or RESTRICT (prevent action). They are fundamental to relational database design.

Related Terms

JSONB
PostgreSQL's binary JSON data type that stores JSON documents with indexing, querying, and manipulation capabilities.
Transaction
A sequence of database operations that are treated as a single unit — either all succeed or all are rolled back.
MVCC (Multi-Version Concurrency Control)
A technique where the database maintains multiple versions of data to allow concurrent reads and writes without locking.
Graph Database
A database that uses graph structures with nodes, edges, and properties to store and query highly connected data.
Connection String
A formatted string containing all parameters needed to establish a connection to a database server.
Connection Pool
A cache of database connections that can be reused, avoiding the overhead of creating new connections for each request.
View All Databases Terms →