17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3: The Foundation Statements of T-<strong>SQL</strong><br />

server — might change at some point. Your ANSI code will more than likely run on the new database server;<br />

however, code that is only T-<strong>SQL</strong> definitely will not.<br />

In this chapter, you have gained a solid taste of making use of single table statements in T-<strong>SQL</strong>, but the<br />

reality is that you often need information from more than one table. In the next chapter, we will learn<br />

how to make use of JOINs to allow us to use multiple tables.<br />

Exercises<br />

1. Write a query that outputs all of the columns and all of the rows from the Product table (in the<br />

Production schema) of the pubs database.<br />

2. Modify the query in Exercise 1 so it filters down the result to just the products that have no<br />

ProductSubcategoryID. (HINT: There are 209, and you will need to be looking for NULL values.)<br />

3. Add a new row into the ProductLocation (in the Production schema) table in the Adventure-<br />

Works database.<br />

4. Remove the row you just added.<br />

79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!