Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
ASP.NET

Primary and Foreign Keys

Identify rows with PKs and link tables with FKs.

Primary and Foreign Keys — a practical guide to SQL primary foreign keys with clear examples you can reuse in real projects.

ASP & ASP.NET Tutorial Series (183/247). Prefer one article? Read the complete ASP.NET tutorial.

Short description

Prefer surrogate int/guid keys unless natural keys are stable.

Keys tip

CREATE TABLE Items (
  Id INT IDENTITY PRIMARY KEY,
  CategoryId INT NOT NULL REFERENCES Categories(Id)
);

Leave a reply

Your email address will not be published. Required fields are marked *