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

Categories

Databases Beginner

What is Primary Key?

A column or set of columns that uniquely identifies each row in a database table.

A primary key ensures every row in a table is unique and identifiable. It cannot contain NULL values and must be unique across all rows. Common choices include auto-incrementing integers (SERIAL) or UUIDs.

Primary keys are automatically indexed for fast lookups. Composite primary keys use multiple columns together. Primary keys are referenced by foreign keys in other tables to create relationships.

Related Terms

Database Constraint
Rules enforced by the database to maintain data integrity, including NOT NULL, UNIQUE, CHECK, PRIMARY KEY, and FOREIGN KEY.
JSONB
PostgreSQL's binary JSON data type that stores JSON documents with indexing, querying, and manipulation capabilities.
Crosstab Query
A query that transforms rows into columns, creating a pivot table view of aggregated data.
Vacuum
A PostgreSQL maintenance operation that reclaims storage from dead tuples and updates statistics for the query planner.
Partitioning
A technique of dividing large database tables into smaller, more manageable segments while maintaining a single logical table.
Window Function
An SQL function that performs calculations across a set of rows related to the current row without collapsing the result set.
View All Databases Terms →