Chapter 9. Avoiding three common query mistakes

Kathi Kellenberger

Writing correct and well-performing queries is both an art and a science. The query must return the expected results and execute in a reasonable time. Many blogs and articles have been written about improving query performance, but this chapter will focus on common mistakes that ultimately cause incorrect or incomplete data to be returned. These are problems I have frequently been asked to help solve or have encountered myself.

The examples in this chapter use SQL Server 2008 and the AdventureWorks2008 database that is available for download at Search for “SQL Server 2008 code samples” on the site to find the latest release of the database. The queries ...

Get SQL Server MVP Deep Dives now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.