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 wooden bee hotel of hollow tubes on a garden wall, each tube sealed separately, one bee landing at its own.

A Multi-Tenant Schema With a TenantId Column: Keys, Indexes and Safety

October 16, 2012
Pinal Dave
SQL Tips and Tricks
Schema, SQL Constraint and Keys, SQL Index, SQL Server, SQL Server Security

Design a multi-tenant schema with composite keys, tenant-first indexes, trusted session context, and row-level security checks.

Read More
Two halves of a snap fastener join as one connection despite being presented from opposite sides

Unique Pairs in Either Order: Blocking A-B When B-A Exists

August 20, 2012
Pinal Dave
SQL Tips and Tricks
Computed Column, Duplicate Records, SQL Constraint and Keys, SQL Index

A plain unique index treats (1, 2) and (2, 1) as different rows. Two computed columns and one index fix that, and I test the awkward cases.

Read More
Magnifying glass silhouette.

SQL SERVER – Curious Case of Disappearing Rows – ON UPDATE CASCADE and ON DELETE CASCADE – Part 1 of 2

August 16, 2012
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Server

Rows kept vanishing from a product table with no DELETE anywhere in the code. Part 1 of a puzzle that leads to ON UPDATE CASCADE and ON DELETE CASCADE.

Read More
Open poultry shears sit around an empty gap beside a cut piece of chicken on a clean board

CHECK Constraints and NULL: Why Unknown Passes the Test

August 13, 2012
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Error Messages, SQL NULL, SQL Table Operation

Why does a CHECK (Quantity > 0) happily store a row with no quantity? Three-valued logic, a small demo, and the NOT NULL fix.

Read More
A garlic press handles one clove through its single chamber while whole garlic bulbs stay outside

Updatable Views: When INSERT and UPDATE Work Through a View

August 9, 2012
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Error Messages, SQL Table Operation, SQL View

A view is only a doorway to the table behind it. I show which writes get through, which get rejected, and why CHECK OPTION earns its place.

Read More
A narrow fabric tape stretches between two fixed clips with cloth extending outside both ends

Time-Limited Access: Expiring Grants With a Valid-Until Column

July 21, 2012
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL DateTime, SQL Server Security, SQL View

A ValidUntil column does nothing by itself. Here is how to make the read path enforce it, with a demo you can run.

Read More
Three porch hooks: a flowering basket, a basket of bare soil, and one empty hook with nothing on it.

JSON_PATH_EXISTS and Typed ISJSON in SQL Server 2022

April 18, 2012
Pinal Dave
SQL Tips and Tricks
JSON, SQL Constraint and Keys, SQL Function, SQL Server, SQL Server 2022

Validate payloads with JSON_PATH_EXISTS and typed ISJSON in SQL Server 2022, distinguish null from missing, and enforce a clear contract.

Read More
Previous 1 … 8 9 10 11 12 13 14 … 24 Next
  • Books
  • Testimonials
  • Privacy Policy

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