Read beginning_t_sql_with_microsoft_sql_server.pdf text version


More information from

Beginning T-SQL with Microsoft SQL Server 2005 and 2008

Description: 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 TSQL 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. Information Technology professionals in many different roles use T-SQL. Our goal is to provide a guide and a reference for IT pros across the spectrum of operational database solution design, database application development, and reporting and business intelligence solutions. Database solution designers will find this book to be a thorough introduction and comprehensive reference for all aspects of database modeling, design, object management, query design, and advanced query concepts. Application developers who write code to manage and consume SQL Server data will benefit from our thorough coverage of basic data management and simple and advanced query design. Several examples of ready-to-use code are provided to get you started and to continue to support applications with embedded T-SQL queries. Report designers will find this book to be a go-to reference for report query design. You will build on a thorough introduction to basic query concepts and learn to write efficient queries to support business reports and advanced analytics. Finally, database administrators who are new to SQL Server will find this book to be an all-inclusive introduction and reference of mainstream topics. This can assist you as you support the efforts of other team members. Beyond the basics of database object management and security concepts, we recommend Beginning SQL Server 2005 Administration and Beginning SQL Server 2008 Administration from Wrox, co-authored in part by the same authors. 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.. This book will help you to learn: How T-SQL provides you with the means to create tools for managing databases of different size, scope, and purpose Various programming techniques that use views, user-defined functions, and stored procedures Ways to optimize query performance How to create databases that will be an essential foundation to applications you develop later Each section of this book organizes topics into logical groups so the book can be read cover-tocover or can be used as a reference guide for specific topics.

We start with an introduction to the T-SQL language and data management systems, and then continue with the SQL Server product fundamentals. This first section teaches the essentials of the SQL Server product architecture and relational database design principles. This section (Chapters 1­3) concludes with an introduction to the SQL Server administrator and developer tools. The next section, encompassing Chapters 4 through 9, introduces the T-SQL language and teaches the core components of data retrieval, SQL functions, aggregation and grouping, and multi-table queries. We start with the basics and build on the core structure of the SQL SELECT statement, progressing to advanced forms of SELECT queries. Chapter 10 introduces transactions and data manipulation. You will learn how the INSERT, UPDATE, and DELETE statements interact with the relational database engine and transaction log to lock and modify data rows with guaranteed consistency. You will not only learn to use correct SQL syntax but will understand how this process works in simple terms. More advanced topics in the concluding section will teach you to create and manage T-SQL programming objects, including views, functions, and stored procedures. You learn to optimize query performance and use T-SQL in application design, applying the query design basics to realworld business solutions. Chapter 15 contains a complete tutorial on using SQL Server 2008 Reporting Services to visualize data from the T-SQL queries you create. The book concludes with a comprehensive set of reference appendixes for command syntax, system stored procedures, information schema views, file system commands, and system management commands. The material in this book applies to all editions of Microsoft SQL Server 2005 and 2008. To use all the features discussed, we recommend that you install the Developer Edition, although you can also use the Enterprise, Standard, or Workgroup editions. SQL Server 2005 Developer Edition or SQL Server 2008 Developer Edition can be installed on a desktop computer running Windows 2000, Windows XP, or Windows Vista. You can also use Windows 2000 Server, Windows Server 2003, or Windows Server 2008 with the Enterprise or Standard edition. The SQL Server client tools must be installed on your desktop computer and the SQL Server relational database server must be installed on either your desktop computer or on a remote server with network connectivity and permission to access.


Introduction. Chapter 1: Introducing T-SQL and Data Management Systems. T-SQL Language. Programming Language or Query Language? What's New in SQL Server 2008. Database Management Systems. SQL Server as a Relational Database Management System. Tables. Relationships. RDBMS and Data Integrity. SQL Server and Other Products. Microsoft SQL Server. Oracle.

IBM DB2. Informix. Sybase SQLAnywhere. Microsoft Access (Jet). MySQL. Summary. Chapter 2: SQL Server Fundamentals. Who Uses SQL Server? SQL Server Editions and Features. SQL Server Compact Edition. SQL Server Express Edition. SQL Server Workgroup Edition. SQL Server Standard Edition. SQL Server Enterprise Edition. Relational Database Engine. Semantics. Changing Terminology. Relationships. Primary Keys. Foreign Keys. Normalization Rules. First Normal Form. Second Normal Form. Third Normal Form. Boyce-Codd Normal Form, Fourth and Fifth Normal Form. Other Normal Forms. Transforming Information into Data. Applying Normalization Rules. Thinking Ahead. Multiple Associations. Multi-Valued Columns.

To Normalize or To De-normalize? Question Authority. The Mechanics of Query Processing. The AdventureWorks Databases. Summary. Chapter 3: SQL Server Tools. Common SQL Server Tasks. SQL Server Management Studio. Tool Windows. Toolbars. SQL Server Management Studio Configuration. SQL Server Business Intelligence Development Studio. SQL Server Profiler. Database Tuning Advisor. SQL Server Configuration Manager. Command-Line Tools. SQLCMD. Writing Queries. Scripting Options. Using the Graphical Query Designer. Using Templates. Using the Debug Feature. Summary. Exercises. Exercise. Exercise 2. Exercise 3. Exercise 4. Chapter 4: Introducing the T-SQL Language. The Nature of SQL. Where to Begin? Data Manipulation Language.

Queries Have Layers. Set-Based Operations. Row-Based Operations. Query Syntax Basics. Naming Conventions. Object Delimiting. Commenting Script. Using Templates. Generating Script. Managing Script. Version Control. Data Definition Language. Creating a Table. Creating a View. Creating a Stored Procedure. Creating a Trigger. Creating a User-Defined Function. Scripting Practices. Data Control Language. Summary. Exercises. Exercise 1. Exercise 2. Chapter 5: Data Retrieval. Storage and Retrieval. The SELECT Statement. Choosing Columns. Column Aliasing. Calculated and Derived Columns. Filtering Rows. The WHERE Clause.

Using Parentheses. Sorting Results. Top Values. Summary. Exercises. Exercise 1. Exercise 2. Exercise 3. Exercise 4. Chapter 6: SQL Functions. The Anatomy of a Function. I'd Like to Have an Argument. Deterministic Functions. Using User Variables with Functions. Using Functions in Queries. Nested Functions. Aggregate Functions. The AVG() Function. The COUNT() Function. The MIN() and MAX() Functions. The SUM() Function. Configuration Variables. The @@ERROR Variable. The @@SERVICENAME Variable. The @@TOTAL_ERRORS Variable. The @@TOTAL_READ Variable. The @@VERSION Variable. Error Functions. Conversion Functions. The CAST() Function. The CONVERT() Function. The STR() Function.

1.0000. Cursor Functions and Variables. The CURSOR_STATUS() Function. The @@CURSOR_ROWS Global Variable. The @@FETCH_STATUS Global Variable. Date Functions. The DATEADD() Function. The DATEDIFF() Function. The DATEPART() and DATENAME() Functions. The GETDATE() and GETUTCDATE() Functions. The SYSDATETIME() and SYSUTCDATETIME() Functions. The DAY(), MONTH(), and YEAR() Functions. String Manipulation Functions. The ASCII(), CHAR(), UNICODE(), and NCHAR() Functions. The CHARINDEX() and PATINDEX() Functions. The LEN() Function. The LEFT() and RIGHT() Functions. The SUBSTRING() Function. The LOWER() and UPPER() Functions. The LTRIM() and RTRIM() Functions. The REPLACE() Function. The REPLICATE() and SPACE() Functions. The REVERSE() Function. The STUFF() Function. The QUOTENAME() Function. Mathematical Functions. Metadata Functions. Ranking Functions. The ROW_NUMBER() Function. The RANK() and DENSE_RANK() Functions. The NTILE(n) Function.

Security Functions. System Functions and Variables. The COALESCE() Function. The DATALENGTH() Function. Global System Statistical Variables. Summary. Exercises. Exercise 1. Exercise 2. Exercise 3. Exercise 4. Exercise 5. Chapter 7: Aggregation and Grouping. To Group or Not to Group. Using Aggregate Functions. The COUNT() Function. The SUM() Function. The AVG() Function. Understanding Statistical Functions. The STDEV() Function. The STDEVP() Function. The VAR() Function. The VARP() Function. User-Defined Aggregate Functions. Grouping Data. The GROUP BY Clause. The HAVING Clause. Total and Subtotal Group Modifiers. Subgrouping. The ROLLUP Clause. The CUBE Clause. The GROUPING() Function.

The COMPUTE and COMPUTE BY Clauses. Summary. Exercises. Exercise 1. Exercise 2. Exercise 3. Chapter 8: Multi-Table Queries. Understanding Subqueries and Joins. Joining Tables in the WHERE Clause. Joining Tables in the FROM Clause. Types of Joins. Inner Joins. Outer Joins. Multicolumn Joins. Non-Equijoins. Special-Purpose Join Operations. Union Queries. Summary. Exercises. Exercise 1. Exercise 2. Exercise 3. Chapter 9: Advanced Queries and Scripting. Subqueries. Scalar Expressions. Alternate Join Operations. Correlated Subqueries. Business Cases for Subqueries. Common Table Expressions. Cursors. Rowset Versus Cursor Operations.

Creating and Navigating a Cursor. Summary. Exercises. Exercise 1. Exercise 2. Exercise 3. Chapter 10: Transactions. Introducing Transactions. Transaction Types. The ACID Test. The Transaction Log. Logged Operations. Let's Do CRUD with Data. Adding Records. Modifying Records. Removing Records. Automating Inserts, Updates, and Deletes with the MERGE Command. Explicit Transactions. Summary. Exercises. Exercise 1. Exercise 2. Exercise 3. Chapter 11: Advanced Capabilities. Pivoting Data. The PIVOT Operator. The UNPIVOT Operator. Full-Text Queries and Approximation Matching. Microsoft Search Service. Soundex Matching. The DIFFERENCE() Function. Managing and Populating Catalogs.

Full-Text Query Expressions. Summary. Exercises. Exercise 1. Exercise 2. Exercise 3. Chapter 12: T-SQL Programming Objects. Views. Virtual Tables. Creating a View. Securing Data. Hiding Complexity. Modifying Data Through Views. Stored Procedures. Stored Procedures as Parameterized Views. Using Parameters. Returning Values. Record Maintenance. Handling and Raising Errors. Error Messages. Processing Business Logic. Looping. User-Defined Functions. Scalar Functions. Inline Table-Valued Functions. Multi-Statement Table-Valued Functions. Transaction Management. Locking Options. Summary. Exercises. Exercise 1.

Exercise 2. Exercise 3. Chapter 13: Creating and Managing Database Objects. Data Definition Language. Creating Objects. Altering Objects. Dropping Objects. Naming Objects. Creating DDL Scripts. CREATE TABLE Unique Identifiers. Constraints. CREATE VIEW. Indexed Views. CREATE PROCEDURE. CREATE FUNCTION. IF EXISTS. Securing Database Objects. Managing Security Objects. Data Control Language. Summary. Exercises. Exercise 1. Exercise 2. Chapter 14: Analyzing and Optimizing Query Performance. Data Retrieval. Analyzing Queries. Session Options. Graphical Execution Plans. Writing Efficient T-SQL (Best Practices). Writing Efficient Filters. Summary.

Exercises. Exercise 1. Chapter 15: T-SQL in Applications and Reporting. Application Programming Models. Selecting a Model. Desktop Database Applications. Client/Server Database Solutions. n-tier Component Solutions. Web Server Applications. Multi-Tier Web Service Solutions. Multi-System Integrated Solutions. SQL Server 2008 Reporting Services. Reporting Services Architecture. SQL Server 2008 Report Design. Deploying the Report. Viewing the Report with Report Manager. Report Data Caching. Business Intelligence and Business Reporting. Report Application Integration. Summary. 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. Index.


Order Online - Order by Fax - using the form below Order by Post - print the order form below and send to

Research and Markets, Guinness Centre, Taylors Lane, Dublin 8, Ireland.

Page 1 of 2 Fax Order Form

To place an order via fax simply print this form, fill in the information below and fax the completed form to 646-6071907 (from USA) or +353-1-481-1716 (from Rest of World). If you have any questions please visit

Order Information

Please verify that the product information is correct. Product Name: Web Address: Office Code: Beginning T-SQL with Microsoft SQL Server 2005 and 2008 OC8DJIQSMPTWXT

Product Format

Please select the product format and quantity you require: Quantity Hard Copy: EURO 31.00 + Euro 25 Shipping/Handling

* Shipping/Handling is only charged once per order.

Contact Information

Please enter all the information below in BLOCK CAPITALS Title: First Name: Email Address: * Job Title: Organisation: Address: City: Postal / Zip Code: Country: Phone Number: Fax Number: * Please refrain from using free email accounts when ordering (e.g. Yahoo, Hotmail, AOL) Mr Mrs Dr Miss Last Name: Ms Prof

Page 2 of 2 Payment Information

Please indicate the payment method you would like to use by selecting the appropriate box. Pay by credit card: American Express Diners Club Master Card Visa Cardholder's Name Cardholder's Signature Expiry Date Card Number CVV Number Issue Date

(for Diners Club only)

Pay by check:

Please post the check, accompanied by this form, to: Research and Markets, Guinness Center, Taylors Lane, Dublin 8, Ireland. Please transfer funds to: Account number Sort code Swift code IBAN number Bank Address 833 130 83 98-53-30 ULSBIE2D IE78ULSB98533083313083 Ulster Bank, 27-35 Main Street, Blackrock, Co. Dublin, Ireland.

Pay by wire transfer:

If you have a Marketing Code please enter it below: Marketing Code: Please note that by ordering from Research and Markets you are agreeing to our Terms and Conditions at

Please fax this form to: (646) 607-1907 or (646) 964-6609 - From USA +353-1-481-1716 or +353-1-653-1571 - From Rest of World


16 pages

Find more like this

Report File (DMCA)

Our content is added by our users. We aim to remove reported files within 1 working day. Please use this link to notify us:

Report this file as copyright or inappropriate


You might also be interested in

CitectSCADA User
SQL Interview Questions and Answers
Microsoft Word - P2005v1_0doc.doc