Chapter 8. Multi-Table Queries

At the beginning of this book, we briefly discussed some of the concepts of database design. You'llrecall that information is often broken down into pieces and stored in several tables to improve accuracy andreduce redundancy. This leaves you with one of the greatest challenges in relational database work—putting the information back together.

In this chapter, you learn about

  • Combining columns from multiple tables using subqueries and joins

  • Using legacy and ANSI standard join syntax applied in the FROM and WHERE clauses

  • The difference between inner, outer, full, and cross joins

  • Applying the UNION operator to combine parallel result sets

A few years ago I rented a diesel front loader to level some property and put in a gravel driveway. I had never operated one before, but I figured that it couldn't be too difficult. It was the kind with four wheels and big rubber tires with deep tread. It had a big lever on each side for each hand that controlled power to the wheels on the left and right sides of the vehicle. The hydraulics were controlled using foot pedals that swiveled in each direction. It really felt like a big video arcade game at first (you know, the big ones that cost a whole dollar per game). Needless to say, it took coordination that I had yet to develop when I started. It handled a little differently than my Ford Mustang. The first thing I did was ease the throttle forward and try to go up a slight incline. The clutches on the traction controls ...

Get Beginning T-SQL with Microsoft® SQL Server® 2005 and 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.