Querying Microsoft SQL Server 2012
Querying Microsoft SQL Server 2012
ttttttt
For more information about any of our training courses, contact our Learning Consultants
on 1300 86 87246 or email us on [email protected]
Course Outline 10774A Visit us on the web at www.advancedtraining.com.au
Version 2.0 May 2012
Course Outline
Module 1: Introduction to the basic structure of T-SQL queries, • Eliminate duplicates using the
Microsoft SQL Server 2012 the logical flow of a SELECT DISTINCT clause.
This module introduces the SQL statement, and introduces concepts • Use column and table aliases.
Server platform and major tools. It such as predicates and set-based • Write simple CASE expressions.
discusses editions, versions, tools operations.
used to query, documentation Lessons Module 5: Querying Multiple
sources, and the logical structure of • Introducing T-SQL Tables
databases. • Understanding Sets This module explains how to write
Lessons • Understanding Predicate Logic queries which combine data from
• Introducing Microsoft SQL • Understanding the Logical Order multiple sources in SQL Server. The
Server 2012 of Operations in SELECT module introduces the use of JOINs
• Getting Started with SQL Server statements in T-SQL queries as a mechanism for
Management Studio Lab: Introduction to Transact- retrieving data from multiple tables.
Lab: Working with SQL Server SQL Querying Lessons
2012 Tools • Executing Basic SELECT • Understanding Joins
• Working with SQL Server Statements • Querying with Inner Joins
Management Studio • Executing queries which filter • Querying with Outer Joins
• Creating and Organizing T-SQL data using predicates • Querying with Cross Joins and
scripts • Executing queries which sort Self Joins
• Using Books Online data using ORDER BY Lab: Querying Multiple Tables
After completing this module, After completing this module, • Writing Queries That Use Inner
students will be able to: students will be able to: Joins
• Describe the architecture and • Describe the elements of T-SQL • Writing Queries That Use
editions of SQL Server 2012. and their role in writing queries Multiple-Table Inner Join
• Work with SQL Server • Describe the use of sets in SQL • Writing Queries That Use Self
Management Studio. Server Joins
• Describe the use of predicate • Writing Queries That Use Outer
Module 2: Getting Started logic in SQL Server Loins
with SQL Azure • Describe the logical order of • Writing Queries That Use Cross
This module introduces you to the operations in SELECT statements Join
concepts of SQL Azure. If the virtual After completing this module,
machines in your classroom are able Module 4: Writing SELECT students will be able to:
to connect to the internet and you Queries • Describe how multiple tables
have a Windows Azure account you This module introduces the may be queried in a SELECT
may be able to connect to your fundamentals of the SELECT statement using joins.
Azure server and database. Many of statement, focusing on queries • Write queries that use inner joins.
the labs in the rest of this course are against a single table. • Write queries that use outer joins.
enabled for you to perform the lab Lessons • Write queries that use self-joins
while connected to your own Azure • Writing Simple SELECT and cross joins.
database in the cloud. Statements
Lessons • Eliminating Duplicates with Module 6: Sorting and
• Overview of SQL Azure DISTINCT Filtering Data
• Working with SQL Azure • Using Column and Table Aliases This module explains how to
After completing this module, • Writing Simple CASE enhance queries to limit the rows
students will be able to: Expressions they return, and to control the order
• Describe the basic features of Lab: Writing Basic SELECT in which the rows are displayed. The
SQL Azure. Statements module also discusses how to
• Provision a SQL Azure server • Write simple SELECT Statements resolve missing and unknown
and configure its security. • Eliminate Duplicates Using results.
Distinct Lessons
Module 3: Introduction to T- • Use Table and Column Aliases • Sorting Data
SQL Querying • Use a Simple CASE Expression • Filtering Data with a WHERE
This module introduces Transact After completing this module, Clause
SQL as the primary querying students will be able to: • Filtering with the TOP and
language of SQL Server. It discusses • Write simple SELECT statements. OFFSET-FETCH Options
For more information about any of our training courses, contact our Learning Consultants
on 1300 86 87246 or email us on [email protected]
Visit us on the web at www.advancedtraining.com.au
Course Outline
• Working with Unknown and • Write queries using date and • Write queries which use
Missing Values time data types. aggregate functions
Lab: Sorting and Filtering Data • Write queries which use distinct
• Writing Queries That Filter Data Module 8: Using Built-In aggregate functions
Using a WHERE Clause Functions • Write queries which filter groups
• Writing Queries That Filter Data This module introduces the use of with the HAVING clause
Using an ORDER BY Clause functions that are built in to SQL After completing this module,
• Writing Queries That Filter Data Server Denali, and will discuss some students will be able to:
Using the TOP Option common usages including data type • Write queries which summarize
• Writing Queries That Filter Data conversion, testing for logical results data using built-in aggregate
Using the OFFSET-FETCH and nullability. functions.
Clause Lessons • Use the GROUP BY clause to
After completing this module, • Writing Queries with Built-In arrange rows into groups.
students will be able to: Functions • Use the HAVING clause to filter
• Filter data with predicates in the • Using Conversion Functions out groups based on a search
WHERE clause. • Using Logical Functions condition.
• Sort data using ORDER BY. • Using Functions to Work with
• Filter data in the SELECT clause NULL Module 10: Using
with TOP. Lab: Using Built-In Functions Subqueries
• Filter data with OFFSET and • Write queries which use This module will introduce the use
FETCH. conversion functions of subqueries in various parts of a
• Write queries which use logical SELECT statement. It will include
Module 7: Working with SQL functions the use of scalar and multi-result
Server 2012 Data Types • Write queries which test for subqueries, and the use of the IN and
This module explains the data types nullability EXISTS operators.
SQL Server uses to store data. It After completing this module, Lessons
introduces the many types of students will be able to: • Writing Self-Contained
numeric and special-use data types. • Write queries with built-in scalar Subqueries
It also explains conversions between functions. • Writing Correlated Subqueries
data types, and the importance of • Use conversion functions. • Using the EXISTS Predicate with
type precedence. • Use logical functions. Subqueries
Lessons • Use functions that work with Lab: Using Subqueries
• Introducing SQL Server 2012 NULL. • Write queries which use self-
Data Types contained subqueries
• Working with Character Data Module 9: Grouping and • Write queries which use scalar
• Working with Date and Time Aggregating Data and multi-result subqueries
Data This module introduces methods for • Write queries which use
Lab: Working with SQL Server grouping data within a query, correlated subqueries and
2012 Data Types aggregating the grouped data and EXISTS predicate
• Writing Queries That Return filtering groups with HAVING. The After completing this module,
Date and Time Data module is designed to help the students will be able to:
• Writing Queries That Use Date student grasp why a SELECT clause • Describe the uses of queries
and Time Functions has restrictions placed upon column which are nested within other
• Writing Queries That Return naming in the GROUP BY clause as queries.
Character Data well as which columns may be listed • Write self-contained subqueries
• Writing Queries That Use in the SELECT clause. which return scalar or multi-
Character Functions Lessons valued results.
After completing this module, • Using Aggregate Functions • Write correlated subqueries
students will be able to: • Using the GROUP BY Clause which return scalar or multi-
• Describe numeric data types, • Filtering Groups with HAVING valued results.
type precedence and type Lab: Grouping and • Use the EXISTS predicate to
conversions. Aggregating Data efficiently check for the existence
• Write queries using character • Write queries which use the of rows in a subquery.
data types. GROUP BY clause
For more information about any of our training courses, contact our Learning Consultants
on 1300 86 87246 or email us on [email protected]
Visit us on the web at www.advancedtraining.com.au
Course Outline
Module 11: Using Table • Write queries which use CROSS Module 14: Pivoting and
Expressions APPLY and OUTER APPLY Grouping Sets
This module introduces T-SQL operators This module discusses techniques for
expressions which return a valid • Write queries which use EXCEPT pivoting data in T-SQL as well to
relational table, typically for further and INTERSECT operators introduce the fundamentals of the
use in the query. The module After completing this module, GROUPING SETS clause. It will also
discusses views, derived tables, students will be able to: cover the use of GROUP BY
common table expressions and inline • Write queries which combine ROLLUP and GROUP BY CUBE
table-valued functions. data using the UNION operator syntax in SQL Server 2012.
Lessons • Write queries which compare Lessons
• Using Derived Tables sets using the INTERSECT and • Writing Queries with PIVOT and
• Using Common Table EXCEPT operators UNPIVOT
Expressions • Write queries which manipulate • Working with Grouping Sets
• Using Views rows in a table by using APPLY Lab: Pivoting and Grouping
• Using Inline Table-Valued with the results of a derived table Sets
Functions or function • Write queries which use the
Lab: Using Table Expressions PIVOT operator
• Write Queries Which Use Views Module 13: Using Window • Write queries which use the
• Write Queries Which Use Ranking, Offset and UNPIVOT operator
Derived Tables Aggregate Functions • Write queries which use the
• Write Queries Which Use This module introduces window GROUPING SETS subclause
Common Table Expressions functions including ranking, After completing this module,
• Write Queries Which Use Inline aggregate and offset functions. Much students will be able to:
Table-Valued Functions of this functionality is new to SQL • Write queries which pivot and
After completing this module, Server 2012. It will cover the use of unpivot result sets
students will be able to: T-SQL functions such as • Write queries which specify
• Write queries which use derived ROW_NUMBER, RANK, multiple groupings with
tables. DENSE_RANK, NTILE, LAG, LEAD, grouping sets
• Write queries which use common FIRST_VALUE and LAST_VALUE
table expressions. to perform calculations against a set, Module 15: Querying SQL
• Create simple views and write or window, of rows. Server Metadata
queries against them. Lessons This module introduces the use of
• Create simple inline table-valued • Creating Windows with OVER SQL Server system objects in T-SQL
functions and write queries • Exploring Window Functions queries. It will cover the use of
against them. Lab: Using Window Ranking, system catalog views, system stored
Offset and Aggregate procedures, system functions, and
Module 12: Using Set Functions dynamic management objects.
Operators • Write queries which use ranking Lessons
This module introduces operations functions • Querying System Catalog Views
involving multiple sets of data. It • Write queries which use offset and Functions
will cover the use of the UNION, functions • Executing System Stored
UNION ALL, APPLY, CROSS • Write queries which use window Procedures
APPLY, OUTER APPLY operators as aggregate functions • Querying Dynamic Management
well as the EXCEPT and After completing this module, Objects
INTERSECTS operators. students will be able to: Lab: Querying SQL Server
Lessons • Describe the benefits to using Metadata
• Writing Queries with the UNION window functions. • Querying System Catalog Views
Operator • Restrict window functions to • Querying System Functions
• Using EXCEPT and INTERSECT rows defined in an OVER clause, • Querying System Dynamic
• Using APPLY including partitions and frames. Management Views
Lab: Using Set Operators • Write queries which use window After completing this module,
• Write queries which use UNION functions to operate on a window students will be able to:
set operators and UNION ALL of rows and return ranking, • Write queries that retrieve
multi-set operators aggregation and offset system metadata using system
comparison results. views and functions.
For more information about any of our training courses, contact our Learning Consultants
on 1300 86 87246 or email us on [email protected]
Visit us on the web at www.advancedtraining.com.au
Course Outline
• Execute system stored execute dynamic SQL statements, Module 19: Implementing
procedures to return system and how to use synonyms. Transactions
information. Lessons This module introduces the concepts
• Write queries that retrieve • T-SQL Programming Elements of transaction management in SQL
system metadata and state • Controlling Program Flow Server. It will provide a high-level
information using system Lab: Programming with T-SQL overview of transaction properties,
dynamic management views and • Declaring Variables and cover the basics of marking
functions. Delimiting Batches transactions with BEGIN, COMMIT
• Using Control-of-Flow Elements and ROLLBACK.
Module 16: Executing Stored • Generating Dynamic SQL Lessons
Procedures • Using Synonyms • Transactions and the Database
This module introduces the use of After completing this module, Engine
existing stored procedures in a T- students will be able to: • Controlling Transactions
SQL querying environment. It • Describe the language elements Lab: Implementing
discusses the use of EXECUTE, how of T-SQL used for simple Transactions
to pass input and output parameters programming tasks. • Controlling transactions with
to a procedure, and how to invoke • Describe batches and how they BEGIN, COMMIT, and
system stored procedures. are handled by SQL Server. ROLLBACK
Lessons • Declare and assign variables and • Adding error handling to a
• Querying Data with Stored synonyms. CATCH block
Procedures • Use IF and WHILE blocks to After completing this module,
• Passing Parameters to Stored control program flow. students will be able to:
Procedures • Describe transactions and the
• Creating Simple Stored Module 18: Implementing differences between batches and
Procedures Error Handling transactions.
• Working with Dynamic SQL This module introduces the use of • Describe batches and how they
Lab: Executing Stored error handlers in T-SQL code. It will are handled by SQL Server.
Procedures introduce the difference between • Create and manage transactions
• Use the EXECUTE statement to compile errors and run-time errors, with transaction control language
invoke stored procedures and will cover how errors affect statements.
• Pass parameters to stored batches. The module will also cover • Use SET XACT_ABORT to define
procedures how to control error handling using SQL Server's handling of
• Execute system stored TRY/CATCH blocks, the use of the transactions outside TRY /
procedures ERROR class of functions, and the CATCH blocks.
After completing this module, use of the new THROW statement.
students will be able to: Lessons Module 20: Improving Query
• Return results by executing • Using TRY / CATCH Blocks Performance
stored procedures. • Working with Error Information This module introduces the concepts
• Pass parameters to procedures. Lab: Implementing Error of system resource usage and the
• Create simple stored procedures Handling performance impact of querying SQL
which encapsulate a SELECT • Redirecting Errors with TRY / Server 2012. It will cover, at a high
statement. CATCH level, the use of indexes in SQL
• Construct and execute dynamic • Using THROW to Pass an Error Server, the use of execution plans in
SQL with EXEC and Message Back to a Client SQL Server Management Studio, and
sp_executesql. After completing this module, the use of SET options to view
students will be able to: system resource usage when
Module 17: Programming • Describe SQL Server's behavior executing queries. It will also
with T-SQL when errors occur in T-SQL code. compare set-based operations with
This module provides a basic • Implement structured exception cursor-based operations.
introduction to T-SQL programming handling in T-SQL. Lessons
concepts and objects. It discusses • Return information about errors • Factors in Query Performance
batches, variables, control of flow from system objects. • Displaying Query Performance
elements such as loops and • Raise user-defined errors and Data
conditionals, how to create and pass system errors in T-SQL Lab: Improving Query Performance
code. • Viewing Query Execution Plans
For more information about any of our training courses, contact our Learning Consultants
on 1300 86 87246 or email us on [email protected]
Visit us on the web at www.advancedtraining.com.au
Course Outline
• Viewing Index Usage and Using
SET STATISTICS Statements
After completing this module,
students will be able to:
• Describe components of well-
performing queries.
• Describe the role of indexes and
statistics in SQL Server
• Display and interpret basic query
plans
• Display and interpret basic query
performance data
For more information about any of our training courses, contact our Learning Consultants
on 1300 86 87246 or email us on [email protected]
Visit us on the web at www.advancedtraining.com.au