Quantcast
Channel: join – sqlsunday.com
Browsing all 14 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Basic string parsing

A lot of times, T-SQL queries aren’t just for compiling huge sets of aggregate calculations or advanced joins and indexing strategies. Sometimes, you need the skills and tools to do some basic string...

View Article



Image may be NSFW.
Clik here to view.

Basic reconciliation skills

You will often encounter situations where you have to reconcile two sets of data – are they the same, and if not, what differences are there? This can be because you re-wrote a piece of code and you...

View Article

Image may be NSFW.
Clik here to view.

JOIN types and performance

There are basically three main types of joins in SQL Server, each one of which has its own characteristics, advantages and drawbacks. You’ll find these three operators in query plans. Knowing how...

View Article

Image may be NSFW.
Clik here to view.

Working with intervals

At one point or another, you’re going to come across intervals when working in SQL Server. You could say that an interval is where you don’t have a single value, but actually a range of values,...

View Article

Image may be NSFW.
Clik here to view.

The assert operator and different types of updates

When you update a column that is tied to a foreign key constraint, SQL Server needs to validate (called “assert“) the new value, in order to make sure that you haven’t added a value with no matching...

View Article


Image may be NSFW.
Clik here to view.

Cross-UPDATEs

A cross-UPDATE is an UPDATE operation that includes one or more other tables, using a JOIN. This is very useful in order to update one table with a value derived from another table. It’s worth noting...

View Article

Image may be NSFW.
Clik here to view.

SQL joins illustrated

Found this piece of brilliance on the Twitterwebs. Wish I would have thought of it first.   Enjoy!

View Article

Image may be NSFW.
Clik here to view.

Joining two SCD2 tables

A number of OLTP systems store dimension data in SCD2-like tables in order to retain all the revisions whenever the dimension information changes. In certain situations, you may come across a need to...

View Article


Image may be NSFW.
Clik here to view.

Comparing nullable columns

Do you ever compare the values of a lot of columns in two tables? Sure you do. Like, for instance, in a cross update, when you need to figure out which rows you should actually update. But it gets...

View Article


Image may be NSFW.
Clik here to view.

Video: three SQL Server join operators in three minutes

In an attempt to try a different approach, here’s a three-minute video explanation of how the different physical join operators in SQL Server work and why you would choose one over the other. More...

View Article

Image may be NSFW.
Clik here to view.

Prioritizing rows in a union

I just remembered a pretty common data challenge the other day. Suppose you have a number of tables, all with similar information in them. You want to union their contents, but you need to prioritize...

View Article

Image may be NSFW.
Clik here to view.

Get the join cheat sheet!

Download and print this nifty little PDF with all of the INNER, LEFT, RIGHT, FULL and CROSS JOINs visualized! It’ll look great on your office wall or cubicle. Your coworkers and your interior decorator...

View Article

Image may be NSFW.
Clik here to view.

The uncorrelated correlated subquery

I’ve seen this accidental pattern more times than I care to remember, and it still bothers me no end. There’s a valuable lesson to be had at the end, though. Some demo data Suppose you have two...

View Article


Image may be NSFW.
Clik here to view.

How to join overlapping date ranges

You can get into a situation where you have two tables with values associated with date ranges. What’s worse, those date ranges don’t necessarily have to align, which can make joining them a seemingly...

View Article
Browsing all 14 articles
Browse latest View live




Latest Images