While I was filming the video to Thinking…Query, named Insert Non-Duplicate Rows, I got the question: instead of a correlated subquery, couldn’t you just use a join with a negative condition? So I included that discussion in the video. To review: the problem we’re trying to resolve is inserting rows FROM Table1 INTO Table2, ignoring duplicates. […]
Author: Jen McCown
Thinking All The Way Around a Query
As so often happens, I had an issue at work today that turned into (I think) a great blog/video idea. Let’s start with a simple scenario: We have two tables, each 2 columns wide, each with a 2 column composite key – meaning that (col1, col2) make up the unique primary key together. We want […]
Case Study: Rebuilding Indexes
It’s not all that uncommon to start a new job, or inherit a project, and find out that index maintenance hasn’t exactly been a priority. One of the first things you want to do is look at fragmentation. This query will pull back all the indexes for My_Database ordered by the average fragmentation in percent. […]