Microsoft SQL Server 2008: T-SQL Fundamentals is a guide that is aimed those beginning to learn the Microsoft SQL Server dialect of the standard ANSI-SQL language. The goal of this book is to teach you the theory behind T-SQL (also known as Transact-SQL) while showing you how to use it in real world situations.
While most of Microsoft SQL Server 2008: T-SQL Fundamentals is not version specific, it does introduce new elements that have been introduced to recent versions. The author makes note of these differences and what version they were added in. The book is 688 pages long and is divided into 10 chapters.
Chapter One, "Background to T-SQL Querying and Programming," provides a theoretical background about SQL, set theory, and predicate logic. It provides an overview to the SQL architecture and demonstrates how to use T-SQL to create tables and define data integrity.
Chapter Two, "Single-Table Queries," now looks at the fundamentals of the SELECT statement for working with single tables. This chapter introduces some of the most fundamental points of working with SQL Server, but ones that will be needed later.
Chapter Three, "Joins," are very important for working with multiple tables. A JOIN operator operates on two input tables and there are three fundamental types: cross, inner, and outer. This chapter also covers composite joins, non-equi joins, and multi-table joins. More advanced aspects are also covered in an optional reading section.
Chapter Four, "Subqueries," are queries within queries. This is also referred to as nesting queries. You will look at self-contained sub-queries, scalar and multi-valued subqueries. There is also an advanced reading section on returning previous and next values, running aggregates, and misbehaving subqueries.
Chapter Five, "Table Expressions," are named query expressions that represent a valid relational table. They can be used in data manipulation statements as you would use other tables. They can simplify your code, improve maintainability, and encapsulate query logic.
Chapter Six, "Set Operations," are operations between two input sets resulting from two input queries. Covered here is the general syntax and requirements of set operations as well as how to use each supported set operation: UNION, INTERSECT, and EXCEPT. Also explained are the two types of each set operation -– DISTINCT, and ALL — as well as providing alternatives to the missing INTERSECT ALL, and EXCEPT ALL.