O'Reilly logo

Beginning Microsoft® SQL Server® 2012 Programming by Paul Atkinson, Robert Vieira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4

JOINs

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • How to combine data from multiple tables into a single result set
  • How to select rows with matching keys
  • Including unmatched rows in your JOIN
  • How to generate massive amounts of data with a Cartesian product
  • What JOIN syntax might look like in older code
  • How to stack multiple result sets together

Feel like a seasoned professional yet? Let me dash that feeling right away (just kidding)! While you now have the basic statements under your belt, they are only a small part of the bigger picture of the statements you will run. To put it simply, there is often not that much you can do with just one table — especially in a highly normalized database.

A normalized database is one where the data has been broken out from larger tables into many smaller tables for the purpose of eliminating repeating data, saving space, improving performance, and increasing data integrity. It’s great stuff and vital to relational databases; however, it also means that you wind up getting your data from here, there, and everywhere.

imageNOTE You’ll look into the concepts of normalization extensively in Chapter 8. For now, though, just keep in mind that the more normalized your database is, the more likely you’re going to have to join multiple tables together in order to get all the data you want.

This chapter introduces you to the process of combining tables ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required