liveBook · Manning

Primary key

A primary key is a designated column or attribute, or combination of them, that uniquely identifies each row or item in a table or data store.

How 21 Manning books explain it

ScyllaDB in Action

A primary key is a table key that uniquely identifies rows and determines their key-based ordering.

How it is used
Guides table design by connecting row identity and partitioning to the queries an application must serve.
How deep it goes
Explains definition, schema syntax, partition-key position, clustering order, inserts, and denormalized table variants without detailing identifier-generation drawbacks.
Examples
Uses restaurant reviews keyed by restaurant, order time, and food, plus article and article-summary tables keyed by IDs and query fields.
What you can do after
Apply it via CQL by defining keys that uniquely identify rows and align partitions and ordering with intended reads.

Read how ScyllaDB in Action explains primary key →

Grokking Relational Database Design

A primary key constraint is an SQL constraint that requires primary-key values to be unique and non-NULL within a table.

How it is used
Identifies each table row and anchors relationships through foreign keys.
How deep it goes
Defines keys, compares candidate and superkeys, guides selection, and implements single-column, named, and composite constraints.
Examples
Uses product_id for products and reviews, user identifiers, email-based SQL definitions, and a purchase_id-plus-code composite key.
What you can do after
Build it from scratch by selecting candidate keys and declaring single-column or composite primary key constraints.

Read how Grokking Relational Database Design explains primary key →

Learn SQL in a Month of Lunches

A primary key constraint is a database rule requiring a table's primary-key values to uniquely identify rows and not be null.

How it is used
Establishes stable row identifiers for relating tables, creating joins, and reducing repeated descriptive data.
How deep it goes
Explains uniqueness, required values, immutability, referential integrity, composite keys, creation syntax, and duplicate-data repair.
Examples
Uses CategoryID and TitleID relationships, a category table, and duplicate OrderID–OrderItem rows in orderitem.
What you can do after
Operate/configure it by adding named single-column or composite PRIMARY KEY constraints and correcting duplicate key data first.

Read how Learn SQL in a Month of Lunches explains primary key →

DuckDB in Action

A primary key is a column or combination of columns whose values uniquely identify every row in a table.

How it is used
Defines row identity, protects data integrity, and supplies reliable join targets in a normalized DuckDB schema.
How deep it goes
Explains single, composite, natural, and surrogate choices with executable definitions, but defers broader migration mechanics.
Examples
Demonstrates systems, readings, and prices tables, plus duplicate inserts and conflict-aware updates.
What you can do after
Build it from scratch by defining appropriate keys and diagnose duplicate-key failures during inserts.

Read how DuckDB in Action explains primary key →

Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

A DynamoDB primary key is the attribute or combination of attributes that uniquely identifies an item in a table.

How it is used
Identifies DynamoDB items and shapes how an application retrieves users and groups tasks by user.
How deep it goes
Defines one- and two-attribute keys, then works through table creation and key-based reads; does not explore key changes after creation.
Examples
Uses AWS CLI user and task tables, Node.js item lookups, and a retried blog-post insert.
What you can do after
Build it from scratch by choosing a DynamoDB key schema, creating tables, and retrieving items by key.

Read how Amazon Web Services in Action, Third Edition: An in-depth guide to AWS explains primary key →

Functional Design and Architecture: Examples in Haskell

A primary key is a field or combination of fields that uniquely identifies a record in a database.

How it is used
Establishes entity identity for type-safe loading and relational table definitions.
How deep it goes
Contrasts composite natural keys with identifiers, then implements entity- and table-specific key ADTs through Haskell type-level machinery.
Examples
Uses meteor and comet records, a composite coordinate-and-time key, and Beam’s DBMeteorId associated ADT.
What you can do after
Build it from scratch by declaring entity-specific key types and extracting a table’s associated primary key.

Read how Functional Design and Architecture: Examples in Haskell explains primary key →

Build Python Web Apps with Streamlit

A primary key is a column or set of columns whose combined values uniquely identify each row in a data table.

How it is used
Identifies individual database rows and distinguishes sales-data records by their combined dimensions.
How deep it goes
Defines single-column and composite keys, then shows PostgreSQL PRIMARY KEY declarations; stops short of declaring a composite key in SQL.
Examples
Uses a multi-column sales CSV key, usernames and haiku IDs, and SQL statements targeting haikus by ID.
What you can do after
Apply it via PostgreSQL CREATE TABLE declarations to identify rows and support foreign-key references.

Read how Build Python Web Apps with Streamlit explains primary key →

Kafka Streams in Action, Second Edition

A primary key is a field or set of fields that uniquely identifies a row in a database table.

How it is used
Uses primary keys to model KTable updates and choose valid aggregation and join strategies.
How deep it goes
Explains update semantics, regrouping, repartitioning, add/subtract aggregation, and foreign key extraction without defining database key constraints.
Examples
Uses user-profile updates, stock alerts grouped by market segment, and client contracts joined with commodity prices.
What you can do after
Apply it via Kafka Streams KTables to regroup records for aggregation and select direct or foreign key table joins.

Read how Kafka Streams in Action, Second Edition explains primary key →

Java Persistence with Spring Data and Hibernate epub

A primary key is a database column or set of columns whose values uniquely identify a row.

How it is used
Identifies table rows and supplies the database identity mapped to a persistent entity.
How deep it goes
Defines candidate-key requirements and explains key selection, immutability, and provider consequences; generator strategies are noted but not detailed here.
Examples
Contrasts a username key with generated user IDs and shows a composite key for a set of embedded images.
What you can do after
Evaluate/understand which candidate key should identify an entity and why changing that key causes persistence problems.

Read how Java Persistence with Spring Data and Hibernate epub explains primary key →

Effective Data Analysis

A primary key is a field or combination of fields that uniquely identifies a record in a dataset or table.

How it is used
Uses shared primary keys to connect datasets and identify relationships when assessing analytical scope or restructuring data.
How deep it goes
Defines identifiers and asks readers to identify keys for joins and schema design, without detailing database implementation.
Examples
Uses shared user or customer identifiers and a normalized startup schema containing customer, activity, address, product, and utility tables.
What you can do after
Apply primary keys to connect datasets, identify joins, and propose fact and dimension tables for analytical use.

Read how Effective Data Analysis explains primary key →

The Well-Grounded Python Developer: How the pros use Python and Flask

A primary key is a column or set of columns that uniquely identifies each record in a relational database table.

How it is used
Identifies records so normalized tables can reconnect through foreign keys and related application data can be loaded.
How deep it goes
Defines table-wide uniqueness, compares existing values with generated integers and UUIDs, and shows when loaded records receive keys.
Examples
Uses social security numbers, auto-incrementing integers, and a UUID-backed User model to illustrate identifier choices.
What you can do after
Apply it via SQLAlchemy by configuring a UUID-backed primary-key column and committing records before creating related orders.

Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains primary key →

100 SQL Server Mistakes and How to Avoid Them

A primary key is a column or set of columns that uniquely identifies each row in a table.

How it is used
Uses primary keys to identify rows and connect related tables through foreign keys.
How deep it goes
Defines primary, foreign, natural, artificial, and composite keys, then demonstrates a typed primary-key declaration.
Examples
Uses EmployeeID, OfficeID, SocialSecurityNumber, and an employee-office relationship to illustrate primary-key choices.
What you can do after
Design primary-key columns, classify key choices, and define an employee identifier with SQL Server-style DDL.

Read how 100 SQL Server Mistakes and How to Avoid Them explains primary key →

Just Use Postgres!

A primary key is a column or set of columns that uniquely identifies each row in a table and cannot contain null values.

How it is used
Establishes row identity and protects database integrity in catalog, review, order, and order-item tables.
How deep it goes
Defines single-column, UUID, and compound keys with executable PostgreSQL table definitions, but defers broader key-design theory.
Examples
Uses catalog and review schemas, UUID-based orders, and order_items keyed by order_id and product_id.
What you can do after
Apply it via PostgreSQL CREATE TABLE definitions using numeric, UUID, or compound primary keys.

Read how Just Use Postgres! explains primary key →

AI-Powered Developer: Build software with ChatGPT and Copilot

A primary key is a column or set of columns that uniquely identifies each row in a relational table.

How it is used
Structures PostgreSQL tables and ORM models around stable row identifiers for an IT asset dataset.
How deep it goes
Defines primary-key columns, sequences, defaults, foreign-key links, and ORM mappings, but does not discuss composite-key design.
Examples
Uses depreciation_strategy, funding_details, and assets tables with integer ids and PostgreSQL sequences.
What you can do after
Build it from scratch by defining primary-key columns, attaching PostgreSQL sequences, and mapping identifiers in ORM classes.

Read how AI-Powered Developer: Build software with ChatGPT and Copilot explains primary key →

Spring in Action, Sixth Edition

A primary key is a Cassandra key definition that identifies rows and can combine partitioning and clustering components.

How it is used
Configures Cassandra-persisted domain classes by identifying rows and assigning partition and row-order responsibilities.
How deep it goes
Explains key annotations, partition placement, clustering order, and generated UUIDs through a Taco mapping.
Examples
Uses Ingredient and Taco mappings, including a UUID partition key, descending createdAt clustering key, and cqlsh output.
What you can do after
Configure Cassandra domain mappings with @PrimaryKey, @PrimaryKeyColumn, partitioning, clustering order, and UUID identifiers.

Read how Spring in Action, Sixth Edition explains primary key →

Build Financial Software with Generative AI (From Scratch)

A primary key is a column or set of columns that uniquely identifies each row in a relational table.

How it is used
Uses unique identifiers to organize ACH records and support relational storage, querying, and integrity.
How deep it goes
Defines primary keys as unique record identifiers and relates them to foreign keys and constraints, without detailing key-generation strategy.
Examples
Uses ACH files, batches, entries, addenda, UUID fields, and PlantUML table definitions to show identifier relationships.
What you can do after
Apply it via relational database design that identifies records and supports links between related ACH tables.

Read how Build Financial Software with Generative AI (From Scratch) explains primary key →

Building Web APIs with ASP.NET Core

A primary key is a property or column whose value uniquely identifies a record in an entity or table.

How it is used
Uses unique record identities to connect related entities in a fixed-schema SQL database.
How deep it goes
Defines uniqueness and demonstrates cross-table references, but stops short of explaining key-generation or constraint implementation.
Examples
Uses Users, Roles, BoardGames, Comments, and the Comments.BoardGameID reference as concrete schema examples.
What you can do after
Evaluate how a relational schema identifies records and represents relationships between tables.

Read how Building Web APIs with ASP.NET Core explains primary key →

.NET in Action, Second Edition

A primary key is a column or set of columns whose values uniquely identify rows in a database table.

How it is used
Identifies entity rows while EF Core generates relational tables from a code-first model.
How deep it goes
Explains convention-based and attribute-based configuration, stopping short of deeper database key behavior.
Examples
Uses a Book entity, a generated Books table, an Id property, and ISBN configured with Key.
What you can do after
Apply it via EF Core by following naming conventions or annotating a different identifying property.

Read how .NET in Action, Second Edition explains primary key →

Starting Data Analytics with Generative AI and Python

A primary key is a column or set of columns whose values uniquely identify records in a dataset.

How it is used
Anchors cross-reference validation by identifying the reference dataset and checking relationships among DataFrames.
How deep it goes
Explains reference and foreign-key relationships with customer, order, and payment examples, then stops short of resolving one violation.
Examples
Uses customer identifiers, order_id, customer orders, payment records, and a foreign-key violation check.
What you can do after
Diagnose broken references and unexpected dataset relationships by comparing foreign-key values with primary-key records.

Read how Starting Data Analytics with Generative AI and Python explains primary key →

Everyday Data Visualization

A primary key is a field whose value uniquely identifies each row in a table.

How it is used
Supports reliable identification of rows in tables containing observations such as visits, users, clicks, or transactions.
How deep it goes
Defines uniqueness, recommends integer identifiers, and notes alphanumeric alternatives without addressing database constraints or implementation.
Examples
Uses fruit IDs, Social Security numbers, driver’s license numbers, license plates, and vehicle identification numbers as examples.
What you can do after
Evaluate whether a table includes a unique identifier for every observation.

Read how Everyday Data Visualization explains primary key →

Learn Haskell by Example

A primary key is a column or set of columns whose values uniquely identify rows in a database table.

How it is used
Identifies Todo entries and constrains inserts, lookups, and updates in a SQLite-backed application.
How deep it goes
Defines declaration, automatic identifier creation, duplicate-insert failure, and identifier-based queries without exploring composite keys.
Examples
Uses an `entries` table with `id INTEGER PRIMARY KEY AUTOINCREMENT` and Haskell functions for insertion, lookup, and update.
What you can do after
Operate/configure SQLite schemas and handle duplicate identifiers during Haskell database operations.

Read how Learn Haskell by Example explains primary key →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.