T-SQL insiders help you tackle your toughest queries and query-tuning problems Squeeze maximum performance and efficiency from every T-SQL query you write or tune. Four leading experts take an in-depth look at T-SQL’s internal architecture and offer advanced practical techniques for optimizing response time and resource usage. Emphasizing a correct understanding of the language and its foundations, the authors present unique solutions they have spent years developing and refining. All code and techniques are fully updated to reflect new T-SQL enhancements in Microsoft SQL Server 2014 and SQL Server 2012. Write faster, more efficient T-SQL code: Move from procedural programming to the language of sets and logic Master an efficient top-down tuning methodology Assess algorithmic complexity to predict performance Compare data aggregation techniques, including new grouping sets Efficiently perform data-analysis calculations Make the most of T-SQL’s optimized bulk import tools Avoid date/time pitfalls that lead to buggy, poorly performing code Create optimized BI statistical queries without additional software Use programmable objects to accelerate queries Unlock major performance improvements with In-Memory OLTP Master useful and elegant approaches to manipulating graphs About This Book For experienced T-SQL practitioners Includes coverage updated from Inside Microsoft SQL Server 2008 T-SQL Querying and Inside Microsoft SQL Server 2008 T-SQL Programming Valuable to developers, DBAs, BI professionals, and data scientists Covers many MCSE 70-464 and MCSA/MCSE 70-461 exam topics
Tackle the toughest set-based querying and query tuning problems—guided by an author team with in-depth, inside knowledge of T-SQL. Deepen your understanding of architecture and internals—and gain practical approaches and advanced techniques to optimize your code’s performance. Discover how to: Move from procedural programming to the language of sets and logic Optimize query tuning with a top-down methodology Assess algorithmic complexity to predict performance Compare data-aggregation techniques, including new grouping sets Manage data modification—insert, delete, update, merge—for performance Write more efficient queries against partitioned tables Work with graphs, trees, hierarchies, and recursive queries Plus—Use pure-logic puzzles to sharpen your problem-solving skills
Apply powerful window functions in T-SQL—and increase the performance and speed of your queries Optimize your queries—and obtain simple and elegant solutions to a variety of problems—using window functions in Transact-SQL. Led by T-SQL expert Itzik Ben-Gan, you’ll learn how to apply calculations against sets of rows in a flexible, clear, and efficient manner. Ideal whether you’re a database administrator or developer, this practical guide demonstrates ways to use more than a dozen T-SQL querying solutions to address common business tasks. Discover how to: Go beyond traditional query approaches to express set calculations more efficiently Delve into ordered set functions such as rank, distribution, and offset Implement hypothetical set and inverse distribution functions in standard SQL Use strategies for improving sequencing, paging, filtering, and pivoting Increase query speed using partitioning, ordering, and coverage indexing Apply new optimization iterators such as Window Spool Handle common issues such as running totals, intervals, medians, and gaps
Master the foundations of T-SQL with the right balance of conceptual and practical content. Get hands-on guidance—including exercises and code samples—that show you how to develop code to query and modify data. You’ll gain a solid understanding of the T-SQL language and good programming practices, and learn to write more efficient and powerful queries. Discover how to: Apply T-SQL fundamentals, create tables, and define data integrity Understand logical query processing Query multiple tables using joins and subqueries Simplify code and improve maintainability with table expressions Explore pivoting techniques and how to handle grouping sets Write code that modifies data Isolate inconsistent data and address deadlock and blocking scenarios
Get a detailed look at the internal architecture of T-SQL with this comprehensive programming reference. Database developers and administrators get best practices, expert techniques, and code samples to master the intricacies of this programming language—solving complex problems with real-world solutions. Discover how to: Work with T-SQL and CLR user-defined functions, stored procedures, and triggers. Handle transactions, concurrency, and error handling. Efficiently use temporary objects, including temporary tables, table variables, and table expressions. Evaluate when to use set-based programming techniques and when to use cursors. Work with dynamic SQL in an efficient and secure manner. Treat date- and time-related data in a robust manner. Develop CLR user-defined types and learn about temporal support in the relational model. Use XML and XQuery and implement a dynamic schema solution. Work with spatial data using the new geometry and geography types and spatial indexes. Track access and changes to data using extended events, SQL Server Audit, change tracking, and change data capture. Use Service Broker for controlled asynchronous processing in database applications. All the book’s code samples will be available for download from the companion Web site.
Effectively query and modify data using Transact-SQL Master T-SQL fundamentals and write robust code for Microsoft SQL Server and Azure SQL Database. Itzik Ben-Gan explains key T-SQL concepts and helps you apply your knowledge with hands-on exercises. The book first introduces T-SQL’s roots and underlying logic. Next, it walks you through core topics such as single-table queries, joins, subqueries, table expressions, and set operators. Then the book covers more-advanced data-query topics such as window functions, pivoting, and grouping sets. The book also explains how to modify data, work with temporal tables, and handle transactions, and provides an overview of programmable objects. Microsoft Data Platform MVP Itzik Ben-Gan shows you how to: Review core SQL concepts and its mathematical roots Create tables and enforce data integrity Perform effective single-table queries by using the SELECT statement Query multiple tables by using joins, subqueries, table expressions, and set operators Use advanced query techniques such as window functions, pivoting, and grouping sets Insert, update, delete, and merge data Use transactions in a concurrent environment Get started with programmable objects–from variables and batches to user-defined functions, stored procedures, triggers, and dynamic SQL
Author: Paul Turley
Publisher: John Wiley & Sons
Release Date: 2011-01-06
If you've not programmed with Transact-SQL, this book is for you.It begins with an overview of SQL Server query operations and tools used with T-SQL, and covers both the 2005 and 2008 releases of SQL Server query tools and the query editor. The book then moves to show you how to design and build applications of increasing complexity. Other important tasks covered include full text indexing, optimizing query performance, and application design and security considerations. The companion website also provides all of the code examples from the book.
Prepare for Microsoft Exam 70-761–and help demonstrate your real-world mastery of SQL Server 2016 Transact-SQL data management, queries, and database programming. Designed for experienced IT professionals ready to advance their status, Exam Ref focuses on the critical-thinking and decision-making acumen needed for success at the MCSA level. Focus on the expertise measured by these objectives: • Filter, sort, join, aggregate, and modify data • Use subqueries, table expressions, grouping sets, and pivoting • Query temporal and non-relational data, and output XML or JSON • Create views, user-defined functions, and stored procedures • Implement error handling, transactions, data types, and nulls This Microsoft Exam Ref: • Organizes its coverage by exam objectives • Features strategic, what-if scenarios to challenge you • Assumes you have experience working with SQL Server as a database administrator, system engineer, or developer • Includes downloadable sample database and code for SQL Server 2016 SP1 (or later) and Azure SQL Database Querying Data with Transact-SQL About the Exam Exam 70-761 focuses on the skills and knowledge necessary to manage and query data and to program databases with Transact-SQL in SQL Server 2016. About Microsoft Certification Passing this exam earns you credit toward a Microsoft Certified Solutions Associate (MCSA) certification that demonstrates your mastery of essential skills for building and implementing on-premises and cloud-based databases across organizations. Exam 70-762 (Developing SQL Databases) is also required for MCSA: SQL 2016 Database Development certification. See full details at: microsoft.com/learning
Your essential guide to key programming features in Microsoft SQL Server 2012 Take your database programming skills to a new level—and build customized applications using the developer tools introduced with SQL Server 2012. This hands-on reference shows you how to design, test, and deploy SQL Server databases through tutorials, practical examples, and code samples. If you’re an experienced SQL Server developer, this book is a must-read for learning how to design and build effective SQL Server 2012 applications. Discover how to: Build and deploy databases using the SQL Server Data Tools IDE Query and manipulate complex data with powerful Transact-SQL enhancements Integrate non-relational features, including native file streaming and geospatial data types Consume data with Microsoft ADO.NET, LINQ, and Entity Framework Deliver data using Windows Communication Foundation (WCF) Data Services and WCF RIA Services Move your database to the cloud with Windows Azure SQL Database Develop Windows Phone cloud applications using SQL Data Sync Use SQL Server BI components, including xVelocity in-memory technologies
Take a detailed look at the internal architecture of T-SQL--and unveil the power of set-based querying--with comprehensive reference and advice from the experts. Database developers and administrators get best practices, sample databases, and code to master the intricacies of the programming language--solving complex problems with real-world solutions. Discover how to: Understand logical and physical query processing Apply a methodology to optimize query tuning Solve relational division problems Use CTEs and ranking functions to simplify and optimize solutions Aggregate data with various techniques, including tiebreakers, pivoting, histograms, and grouping factors Use the TOP option in a query to modify data Query specialized data structures with recursive logic, materialized path, or nested sets solutions PLUS--Improve your logic and get to the heart of querying problems with logic puzzles Get code and database samples on the Web
Dive deep inside the architecture of SQL Server 2012 Explore the core engine of Microsoft SQL Server 2012—and put that practical knowledge to work. Led by a team of SQL Server experts, you’ll learn the skills you need to exploit key architectural features. Go behind the scenes to understand internal operations for creating, expanding, shrinking, and moving databases—whether you’re a database developer, architect, or administrator. Discover how to: Dig into SQL Server 2012 architecture and configuration Use the right recovery model and control transaction logging Reduce query execution time through proper index design Track events, from triggers to the Extended Event Engine Examine internal structures with database console commands Transcend row-size limitations with special storage capabilities Choose the right transaction isolation level and concurrency model Take control over query plan caching and reuse
Delve inside the core SQL Server engine—and put that knowledge to work—with guidance from a team of well-known internals experts. Whether database developer, architect, or administrator, you’ll gain the deep knowledge you need to exploit key architectural changes—and capture the product’s full potential. Discover how SQL Server works behind the scenes, including: What happens internally when SQL Server builds, expands, shrinks, and moves databases How to use event tracking—from triggers to the Extended Events Engine Why the right indexes can drastically reduce your query execution time How to transcend normal row-size limits with new storage capabilities How the Query Optimizer operates Multiple techniques for troubleshooting problematic query plans When to force SQL Server to reuse a cached query plan—or create a new one What SQL Server checks internally when running DBCC How to choose among five isolation levels and two concurrency models when working with multiple concurrent users
Ace your preparation for Microsoft® Certification Exam 70-461 with this 2-in-1 Training Kit from Microsoft Press®. Work at your own pace through a series of lessons and practical exercises, and then assess your skills with practice tests on CD—featuring multiple, customizable testing options. Maximize your performance on the exam by learning how to: Create database objects Work with data Modify data Troubleshoot and optimize queries You also get an exam discount voucher—making this book an exceptional value and a great career investment.
SQL Server 2012 T-SQL Recipes is an example-based guide to the Transact-SQL language that is at the core of SQL Server 2012. It provides ready-to-implement solutions to common programming and database administration tasks. Learn to create databases, insert and update data, generate reports, secure your data, and more. Tasks and their solutions are broken down into a problem/solution format that is quick and easy to read so that you can get the job done fast when the pressure is on. Solutions in this book are divided into chapters by problem domain. Each chapter is a collection of solutions around a single facet of the language such as writing queries, developing triggers, and applying aggregate functions. Each solution is presented code-first, giving you a working code example to copy from and implement immediately in your own environment. Following each example is an in-depth description of how and why the given solution works. Tradeoffs and alternative approaches are also discussed. Focused on solutions: Look up what you need to do. Learn how to do it. Do it. Current: Newly updated for SQL Server 2012 Comprehensive: Covers all common T-SQL problem domains What you’ll learn Create databases, tables, and indexes Query and manipulate data Store and manage XML inside the database Move business logic into the database Resolve common performance problems. Build reports that matter to your business. Perform common backup and recovery tasks. Who this book is for SQL Server 2012 T-SQL Recipes is aimed at technically-oriented users of SQL Server desiring to extract the full power of the platform through it's powerful, built-in programming and scripting language. Target readers include developers who use Microsoft SQL Server 2012 as their back–end database, and the database administrators who create, manage, and secure those databases. Table of Contents Getting Started with SELECT Elementary Programming Nulls and Other Pitfalls Combining Data from Multiple Tables Grouping and Summarizing Advanced SELECT Techniques Query Techniques for Reporting Inserting, Updating, Deleting Working with Strings Working with Dates Working with Numbers Transactions, Locking, Blocking, Deadlocking Managing Tables Managing Views Managing Indexes Managing Large Tables Stored Procedures User-Defined Functions Triggers Error Handling Query Performance Hints Index Tuning and Statistics XML Files, Filegroups, and Integrity Backup Recovery Principals and Users Securables and Permissions Objects and Dependencies