MS 10774: Querying Microsoft SQL Server 2012
Course Objectives
This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server 2012. This course is the foundation for all SQL Server-related disciplines; namely, Database Administration, Database Development and Business Intelligence.
This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server 2012. This course is the foundation for all SQL Server-related disciplines; namely, Database Administration, Database Development and Business Intelligence. This course helps people prepare for exam 70-461. Many of the exercises in this course are SQL Azure enabled.
This course (10774AB) utilizes pre-release software in the virtual machine for the labs. Microsoft SQL Server 2012 Release Candidate 0 (RC0) is used in this course. Many of the exercises in this course are SQL Azure enabled.
Module1: Introduction to Microsoft SQL Server 2012This Moduleintroduces the SQL Server platform and major tools. It discusses editions, versions, tools used to query, documentation sources, and the logical structure of databases.
Lessons
Write queries which summarize data using built-in aggregate functions
Use the GROUP BY clause to arrange rows into groups
Use the HAVING clause to filter out groups based on a search condition
Module9: Using Subqueries
This Modulewill introduce the use of subqueries in various parts of a SELECT statement. It will include the use of scalar and multi-result subqueries, and the use of the IN and EXISTS operators.
Lessons
- SQL Server Denali Architecture
- Working with SQL Server Denali Tools
- Working with SQL Server Databases
- Working with SQL Server Management Studio
- Exploring with Database Objects
- Organizing and Creating T-SQL Scripts
- Using Books Online
- Describe SQL Server components
- Create and save T-SQL scripts in SQL Server Management Studio
- Browse the objects in a database
- Search T-SQL syntax definitions in Books Online
- Introducing Transact-SQL
- Understanding Sets
- Understanding Predicate Logic
- Understanding the Logical Order of Operations in SELECT Statements
- Executing Basic SELECT Statements
- Executing queries which filter data using predicates
- Executing queries which sort data using ORDER BY
- Describe the elements of T-SQL and its role in writing queries
- Describe the use of sets in SQL Server
- Describe the use of predicate logic in SQL Server
- Define the logical order of operations in SELECT statements
- Writing Simple SELECT Statements
- Eliminating Duplicates with DISTINCT
- Using Column and Table Aliases
- writing Simple CASE Expressions
- Write simple SELECT statements
- Eliminate Duplicates using DISTINCT
- Use table and column aliases
- Use a simple CASE expression
- Write Simple SELECT statements
- Eliminate duplicates using the DISTINCT clause
- Use column and table aliases
- Write simple CASE expressions
- Understanding Joins
- Querying With Inner Joins
- Querying With Outer Joins
- Querying Using Self and Cross Joins
- Write queries using inner joins
- Write queries using multi-table joins
- Write queries using self joins
- Write queries using outer joins
- Describe how multiple tables may be queried in a SELECT statement using joins
- Write queries which use inner joins
- Write queries which use outer joins
- Write queries which use self-joins and cross joins
- Sorting Data
- Filtering Data
- Filtering with the TOP and OFFSET-FETCH Options
- Working with Unknown Values
- Write queries that filter data using a WHERE clause
- Write queries that sort data with the ORDER BY clause
- Write queries that filter data using the TOP option
- Write queries that filter data using the OFFSET-FETCH clause
- Filter data with predicates in the WHERE clause
- Sort data using ORDER BY
- Filter data in the SELECT clause with TOP
- Filter data with OFFSET and FETCH
- Understand and handle NULLs
- Introducing SQL Server Denali Data Types
- Working with Character Data
- Working with Date and Time Data
- Write queries which return date and time data
- Write queries which use date and time functions
- Write queries which return character data
- Write queries which use character functions
- Describe numeric data types, type precedence and type conversions
- Write queries using character data types
- Write queries using date and time data types
- Writing Queries with Built-In Functions
- Using Conversion Functions
- Using Logical Functions
- Using Functions to Test for Nullability
- Write queries which use conversion functions
- Write queries which use logical functions
- Write queries which test for nullability
- Write queries with built-in scalar functions
- Use conversion functions
- Use logical functions
- Use functions that work with NULL
- Using Aggregate Functions
- Using the GROUP BY Clause
- Filtering Groups with the HAVING Clause
- Write queries which use the GROUP BY clause
- Write queries which use aggregate functions
- Write queries which use distinct aggregate functions
- Write queries which filter groups with the HAVING clause
- Writing Self-Contained Subqueries
- Writing Correlated Subqueries
- Using the EXISTS Predicate with Subqueries
- Write queries which use self-contained subqueries
- Write queries which use correlated subqueries
- Write queries which use scalar and multi-result subqueries
- Write queries which use the IN and EXISTS predicates
- Use self-contained subqueries, correlated subqueries, scalar subqueries, and multi-valued subqueries
- Use the IN and EXISTS predicates
- Views
- Table Expressions Lab: Using Table Expressions
- Write queries which use views
- Write queries which use derived tables
- Write queries which use common table expressions
- Write queries which use inline table-valued expressions
- Write queries against views
- Use derived tables
- Use common table expressions
- Use inline table-valued expressions
- Write queries which use UNION set operators and UNION ALL multi-set operators
- Write queries which use CROSS APPLY and OUTER APPLY operators
- Write queries which use APPLY with derived tables and functions
- Write queries which use EXCEPT and INTERSECT operators
- Describe the difference between a set and a multi-set
- Use the UNION and UNION ALL operators
- Use CROSS APPLY, OUTER APPLY and APPLY
- Use EXCEPT and INTERSECT operators
- Write queries which use ranking functions
- Write queries which use offset functions
- Write queries which use window aggregate functions
- Use window ranking functions ROW_NUMBER, RANK, DENSE_RANK, NTILE
- Use offset functions LAG, LEAD, FIRST_VALUE, LAST_VALUE
- Use window aggregate functions
- Use the basic forms of window partitioning, window ordering and window framing
- Write queries which use the PIVOT operator
- Write queries which use the GROUPING SETS subclause
- Write queries which use GROUP BY ROLLUP
- Write queries which use GROUP BY CUBE
- Use the basic form of PIVOT and UNPIVOT operators
- Use the fundamental form of GROUPING SETS clause
- Querying system catalog views
- Querying system functions
- Querying system dynamic management views
- Write queries against system catalog views and functions
- Execute system stored procedures
- Identify and query system dynamic management objects
- Describe security permissions necessary to query system objects
- Use the EXECUTE statement to invoke stored procedures
- Pass parameters to stored procedures
- Return results from a stored procedure using the OUTPUT clause
- Execute system stored procedures
- Invoke existing stored procedures with EXECUTE
- Pass input parameters and receive output parameters
- Generate dynamic SQL statements
- Declaring variables and delimiting batches
- Using control of flow elements
- Generating dynamic SQL
- Using synonyms
- Understand where T-SQL programming objects can be used
- Declare variables and delimit batches
- Use control of flow elements such as IF, WHILE, BEGIN, END, RETURN
- Use synonyms Module17: Implementing Error Handling This Moduleintroduces the use of error handlers in T-SQL code. It will introduce the difference between compile errors and run-time errors, and will cover how errors affect batches. The Modulewill also cover how to control error handling using TRY/CATCH blocks, the use of the ERROR class of functions, and the use of the new THROW statement Lab: Implementing Error Handling
- Redirecting errors with TRY/CATCH
- Creating error handling routines in a CATCH block with ERROR functions
- Using THROW to pass an error message back to a client
- Describe the behavior of SQL Server when errors occur in T-SQL code
- Use TRY/CATCH blocks to handle error flow
- Understand ERROR class functions
- Controlling transactions with BEGIN and COMMIT
- Using XACT_ABORT
- Adding transaction handling logic to a CATCH block
- Describe the benefits of using transactions
- Control transactions with BEGIN, COMMIT, ROLLBACK
- Describe error handling behavior in transactions
- Viewing query execution plans
- Using SET STATISTICS statements
- Viewing index usage
- Comparing cursors to set-based queries
- Describe how SQL Server uses indexes to support query execution
- Enable the display of execution plans in SQL Server Management Studio
- Enable system IO and time information in query results
- Describe the differences between accessing data in sets versus via cursors

This course is intended for Database Administrators, Database Developers, and Business Intelligence professionals. The course will very likely be well attended by SQL power users who aren’t necessarily database-focused or plan on taking the exam; namely, report writers, business analysts and client application developers.

Upon successful completion of this course, delegates will have the necessary skills to:
- Write SELECT Queries
- Query Multiple Tables
- Use Built-In Functions
- Use Subqueries
- Execute Stored Procedures
- Use Set Operators
- Implement Error Handling
- Implementing Transactions
- Use Table Expressions
- Sort and Filter Data
- Use Window Ranking, Offset and Aggregate Functions
- Query SQL Server Metadata
- Program with T-SQL
- Improve Query Performance


