This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
A platform luggage cart of suitcases each carrying a huge wooden tag, except one with a small vermilion tag.

Narrow Index Keys: Why the Clustered Key Width Matters Everywhere

September 3, 2013
Pinal Dave
SQL Performance
Clustered Index, Primary Key, SQL Index, SQL Server

Evaluate narrow index keys by comparing clustered GUID and integer designs, measuring index pages, and preserving natural uniqueness.

Read More
A new wooden shelf unit standing on a workshop floor beside a small dish of wooden pegs, one red peg nearby.

Designing Your First Table: Columns, Keys and Data Types

September 1, 2013
Pinal Dave
SQL Tips and Tricks
Primary Key, SQL Column, SQL Constraint and Keys, SQL Datatype, SQL Table Operation

Designing Your First Table gets easier when you decide what it must hold before you write any SQL. This post walks through naming, data types, NULL or NOT NULL, a primary key, a default and a check constraint on a small Customers table. It also shows what to leave for later.

Read More
Two wooden storage boxes on the floor joined by a short chain locked with a red padlock, one lid open.

What Is a Foreign Key, and What It Protects

August 13, 2013
Pinal Dave
SQL Tips and Tricks
Database, Primary Key, SQL Constraint and Keys, SQL Index

What is a foreign key? It’s a column that must match a key in another table, and SQL Server refuses any value that has no match. This post shows the error it raises, the ON DELETE options, and why the foreign key column needs an index of its own.

Read More
A riveting tool aligns a new rivet with existing holes that preserve the old fastening positions

Explicit Identity Values: Loading Rows With Their Old Keys

August 7, 2012
Pinal Dave
SQL Tips and Tricks
Primary Key, SQL Identity, SQL Migration, SQL Table Operation

Moving rows and keeping their old keys? Here is the safe order of steps, and the counter check that saves you from a collision.

Read More
A white picket fence around a neat vegetable bed with a red gate latch and one tall sunflower standing out of line inside.

Create Constraints Quiz: What Does WITH NOCHECK Leave Behind?

January 18, 2012
Pinal Dave
SQL Puzzle
Primary Key, SQL Column, SQL Constraint and Keys, SQL Table Operation

This Create Constraints Quiz adds a CHECK constraint WITH NOCHECK to a table that already holds a bad row. The bad row stays, and the constraint is marked not trusted. A tested script proves it, shows what trust changes for the optimizer and lists four ways to create a constraint.

Read More
A dog with a plain brass tag on its collar sitting beside a pile of older collars in different colors and sizes.

Surrogate Keys and Natural Keys

September 18, 2011
Pinal Dave
SQL Tips and Tricks
Business Intelligence, Data Warehousing, Primary Key, SQL Constraint and Keys, SQL Server

Surrogate keys keep warehouse history stable while natural keys preserve source identity; learn lookup, uniqueness, and change handling.

Read More
Tangled fishing flies lie beside matching flies secured individually in a foam fly wallet

Large IN Lists: When a Temp Table Beats Thousands of Values

August 1, 2011
Pinal Dave
SQL Tips and Tricks
Primary Key, SQL Performance, SQL Sub Query, Temp Table

Pasting thousands of IDs into an IN list works, until it does not. See where the time goes and how to keep the answer the same with a temp table.

Read More
Previous 1 2 3 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com