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 basketball net above a basketball with a different practice ball kept outside

Makers That Sell PCs but Not Laptops: HAVING With Conditional Counts

February 25, 2014
Pinal Dave
SQL Tips and Tricks
SQL CASE, SQL Group By, SQL Sub Query

One WHERE clause cannot say ‘has a PC but no laptop’. Here are three queries that can, and the NULL trap.

Read More
Three sorting bins in a row with a red rubber boot on the ground that fits none.

CASE Expression Pitfalls: NULL Tests and Data Type Precedence

April 20, 2013
Pinal Dave
SQL Tips and Tricks
SQL CASE, SQL Datatype, SQL NULL, SQL Server

Reproduce CASE expression traps with NULL tests, mixed result types, missing ELSE, and nesting, then apply clear rewrites.

Read More
Blue, sage and cream textile panels hang in order above folded cloth and a red spool.

CASE Sort Priority: Put Business Order Before Alphabetical Order

May 10, 2009
Pinal Dave
SQL Tips and Tricks
SQL CASE, SQL NULL, SQL Order By, SQL Server

CASE sort priority makes the queue policy explicit. Map known statuses to numeric ranks and keep missing or unfamiliar labels visible. Finish tied ranks with a unique key.

Read More
Three glass fishing floats in rope nets hanging from three of four wooden pegs, the last peg left empty.

CHOOSE: Handle Indexes Outside the List

April 7, 2007
Pinal Dave
SQL Tips and Tricks
SQL CASE, SQL Function, SQL Server

CHOOSE returns an item from a positional list. Check unsupported indexes and compare a consistently typed CASE expression with an explicit fallback.

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

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