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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Contents<br />

Making Use of Hints Using the OPTION Clause 64<br />

The DISTINCT and ALL Predicates 64<br />

Adding Data with the INSERT Statement 67<br />

Multirow Inserts 72<br />

The INSERT INTO . . . SELECT Statement 73<br />

Changing What Y ou’ve Got with the UPD ATE Statement 75<br />

The DELETE Statement 77<br />

Summary 78<br />

Exercises 79JOINs<br />

81<br />

JOINs 81<br />

INNER JOINs 83<br />

How It Works 88<br />

How an INNER JOIN Is Like a WHERE Clause 88<br />

How It Works 90<br />

OUTER JOINs 91<br />

The Simple OUTER JOIN 91<br />

How It Works 94<br />

How It Works 94<br />

Finding Orphan or Non-Matching Records 94<br />

Dealing with More Complex OUTER JOINs 97<br />

Seeing Both Sides with FULL JOINs 101<br />

How It Works 103<br />

CROSS JOINs 103<br />

Exploring Alter native Syntax for Joins 104<br />

An Alternative INNER JOIN 105<br />

An Alternative OUTER JOIN 105<br />

An Alternative CROSS JOIN 106<br />

The UNION 107<br />

How It Works 109<br />

Summary 111<br />

Exercises 112<br />

Chapter 5: Creating and Altering T ables 113<br />

Object Names in <strong>SQL</strong> Ser ver 113<br />

Schema Name (aka Ownership) 114<br />

A Little More About Schemas 114<br />

The Default Schema: dbo 115<br />

The Database Name 116<br />

Naming by <strong>Server</strong> 116<br />

Reviewing the Defaults 117<br />

xvii

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

Saved successfully!

Ooh no, something went wrong!