From the course: SQL Server 2008 Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Joining multiple tables together

Joining multiple tables together - SQL Server Tutorial

From the course: SQL Server 2008 Essential Training

Start my 1-month free trial

Joining multiple tables together

After awhile you are going to find that be very straightforward SQL statements, like this one where I'm simply selecting three pieces of data from the Product table, well they don't get all that fantastically useful. What I'm retrieving here is the name of a product, the color of the product, and the ProductCategoryID, which in this case is 18 or 27 or 23, which is not all that helpful if I'm just reading this data. I want to know what the category is. Well I know that my database has the category stored in it but it's not in this table and here's why. I have got a simple diagram that's just showing these parts of this AdventureWorksLT database. There is a Product table with all these columns in and then there a ProductCategory table and this is simply good normalization. We can have multiple products in category, so it's a good idea to take that category data out and put it in its own table. And what this really means for MySQL statement is I want one SQL statement to be retrieving…

Contents