Print this page Share

Beginning T-SQL with Microsoft SQL Server 2005 and 2008

ISBN: 978-0-470-25703-6
676 pages
December 2008
Beginning T-SQL with Microsoft SQL Server 2005 and 2008 (0470257032) cover image


Transact-SQL, or T-SQL, is Microsoft Corporation's powerful implementation of the ANSI standard SQL database query language, which was designed to retrieve, manipulate, and add data to relational database management systems (RDBMS).

You may already have a basic idea of what SQL is used for, but you may not have a good understanding of the concepts behind relational databases and the purpose of SQL. This book will help you build a solid foundation of understanding, beginning with core relational database concepts and continuing to reinforce those concepts with real-world T-SQL query applications.

If you are familiar with relational database concepts but are new to Microsoft SQL Server or the T-SQL language, this book will teach you the basics from the ground up. If you're familiar with earlier versions of SQL Server, it will get you up-to-speed on the newest features. And if you know SQL Server 2005, you'll learn about some exciting new capabilities in SQL Server 2008.

This book introduces the T-SQL language and its many uses, and serves as a comprehensive guide at a beginner through intermediate level. Our goal in writing this book was to cover all the basics thoroughly and to cover the most common applications of T-SQL at a deeper level. Depending on your role and skill level, this book will serve as a companion to the other Wrox books in the Microsoft SQL Server Beginning and Professional series.

See More

Table of Contents


Chapter 1: Introducing T-SQL and Data Management Systems.

Chapter 2: SQL Server Fundamentals.

Chapter 3: SQL Server Tools.

Chapter 4: Introducing the T-SQL Language.

Chapter 5: Data Retrieval.

Chapter 6: SQL Functions.

Chapter 7: Aggregation and Grouping.

Chapter 8: Multi-Table Queries.

Chapter 9: Advanced Queries and Scripting.

Chapter 10: Transactions.

Chapter 11: Advanced Capabilities.

Chapter 12: T-SQL Programming Objects.

Chapter 13: Creating and Managing Database Objects.

Chapter 14: Analyzing and Optimizing Query Performance.

Chapter 15: T-SQL in Applications and Reporting.

Appendix A: Command Syntax Reference.

Appendix B: System Variables and Functions Reference.

Appendix C: System Stored Procedure Reference.

Appendix D: Information Schema Views Reference.

Appendix E: FileStream Objects and Syntax.

Appendix F: Answers to Exercises.


See More

Author Information

Paul Turley (Vancouver, WA) is a Manager of Specialized Services for Hitachi Consulting Education Services. Paul manages the Business Intelligence training team and teaches classes for companies throughout the world on Microsoft SQL Server technologies. He works with companies to architect and build BI and reporting solutions. He has been developing business database solutions since 1991 for companies like Microsoft, Disney, Nike, and Hewlett - Packard. He has been a Microsoft Certified Trainer since 1996 and holds several industry certifications, including MCTS and MCITP for BI, MCSD, MCDBA, MSF Practitioner, and IT Project+.
Paul has authored and co - authored several books and courses on database, business intelligence, and application development technologies. He is the lead courseware developer for the Hitachi Consulting courses: SQL Server 2008 Business Intelligence Solutions and SQL Server 2008 Reporting Services Solutions. Books include the prior edition of this book, the 2008, 2005 and 2000 editions of Professional SQL Server Reporting Services , Beginning SQL Server 2005 Administration , Beginning Access 2002 VBA , Data Warehousing with SQL Server 2000 Analysis Services , and Professional Access 2000 Programming — all from Wrox. He is also a contributing author for SQL Server 2005 Integration Services Step by Step from Microsoft Press.

Dan Wood (Silverdale, WA) is the senior database administrator for Avalara, a sales tax compliance company, where he both administers and develops database solutions for several enterprise applications that handle global address validation, tax rate calculation, and sales tax remittance for e - commerce and ERP clients. He has been working with SQL Server as a DBA, consultant, and trainer since 1999. Dan was a contributing author on Beginning Transact - SQL with SQL Server 2000 and 2005 and the lead author of Beginning SQL Server Administration , both from Wrox.

See More


Download TitleSizeDownload
Readme 1.74 KB Click to Download
All Code Downloads for Beginning T-SQL
Chapter 6, Exercise 1 updated on 1/3/2011
23.67 KB Click to Download
Errata: New Code for Chapter 6, Exercise 1
The problem in Chapter 6, Exercise 1 should read:

Write a query to return the average weight of all touring bikes
sold by Adventure Works Cycles that list for more than $2,300.
Use the ProductSubCategory table to determine how you should
filter these products. The correct script would be: -- Exercise 1 Solution ---------------------- -- (Correction from instructions... include touring bikes with
list price over $2,300 rather than $2,500) SELECT AVG(Weight) FROM Production.Product WHERE ProductSubcategoryID = 3 and ListPrice > 2300
23.67 KB Click to Download
See More


Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
9 Error in Text
On page 9 under decimal type, the parenthetical scientific notation to the all 9s string should be +10^38 - 1
217 Error in Code
Beginning T-SQL, page 217, exercise 1 asks for all average weight of all touring bikes with a list price over $2,500.

The code provided ignores list price and averages the weight of the 22 touring bikes sold by Adventure Works Cycles. In fact, there are no touring bikes priced over $2,500.
10 315 Error in Code
Currently reads:

    @ContactID      int
  , @FirstName      nvarchar(50)
  , @LastName       nvarchar(50)
  , @Phone          nvarchar(25)
   UPDATE MyContacts 
   SET FirstName = @FirstName
     , LastName = @LastName
     , Phone = @Phone

spUpd_MyContacts 5, 'Betrice', 'Rubble', '(222) 234-7654'

Should be:

@ContactID int
, @FirstName nvarchar(50)
, @LastName nvarchar(50)
, @Phone nvarchar(25)
UPDATE MyContacts 
SET FirstName = @FirstName
, LastName = @LastName
, Phone = @Phone
WHERE ContactID = @ContactID
503 Error in Text
At the bottom of the page, after keyword UNION the keyword SELECT is missing. The code should read:

SELECT -1 AS ProductCategoryID, '(All Categories)' AS Name
SELECT ProductCategoryID, NAME
FROM Production.ProductCategory
See More

Related Titles

Back to Top