DescriptionTransact-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.
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.
|All Code Downloads for Beginning T-SQL|
Chapter 6, Exercise 1 updated on 1/3/2011
|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
|9||Error in Text,On page 9 under decimal type, the parenthetical scientific notation to the all 9s string should be +10^38 - 1||10/13/09|
|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:|
CREATE PROCEDURE spUpd_MyContacts @ContactID int , @FirstName nvarchar(50) , @LastName nvarchar(50) , @Phone nvarchar(25) AS UPDATE MyContacts SET FirstName = @FirstName , LastName = @LastName , Phone = @Phone spUpd_MyContacts 5, 'Betrice', 'Rubble', '(222) 234-7654'
CREATE PROCEDURE spUpd_MyContacts @ContactID int , @FirstName nvarchar(50) , @LastName nvarchar(50) , @Phone nvarchar(25) AS 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
ORDER BY Name