You are on page 1of 5

NE-20761C

Querying Data with Transact-SQL

Summary

Duration Level Technology Delivery Method Training Credits

Classroom ILT
5 Days Intermediate SQL Server Virtual ILT SATV
On Demand

Introduction
This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can be
taught as a course to students requiring the knowledge for other courses in the SQL Server curriculum. Days 4 & 5 teach
the remaining skills required to take exam 70-761.

Audience Profile
The main purpose of the course is to give students a good understanding of the Transact-SQL language which is used by
all SQL Server-related disciplines; namely, Database Administration, Database Development and Business Intelligence. As
such, the primary target audience for this course is: Database Administrators, Database Developers and BI professionals.

Prerequisites
Before attending this course, students must have:
• Working knowledge of relational databases

Course Objectives
After completing this course, students will be able to:
• Describe key capabilities and components of SQL Server
• Describe T-SQL, sets, and predicate logic
• Write a single table SELECT statement
• Write a multi-table SELECT statement
• Write SELECT statements with filtering and sorting
• Describe how SQL Server uses data types
• Write DML statements
• Write queries that use built-in functions
• Write queries that aggregate data
• Write subqueries
• Create and implement views and table-valued functions
• Use set operators to combine query results
• Write queries that use window ranking, offset, and aggregate functions
• Transform data by implementing pivot, unpivot, rollup and cube
• Create and implement stored procedures
• Add programming constructs such as variables, conditions, and loops to T-SQL code

Course Content
Module 1: Introduction to • Using Books Online Module 2: Introduction to T-SQL
Microsoft SQL Server After completing this module, Querying
This module introduces SQL Server, students will be able to: This module describes the elements
the versions of SQL Server, • Describe relational of T-SQL and their role in writing
including cloud versions, and how to databases and Transact- queries. Describe the use of sets in
connect to SQL Server using SQL SQL queries SQL Server. Describe the use of
Server Management Studio. • Describe the on-premise predicate logic in SQL Server.
Lessons and cloud-based editions Describe the logical order of
• The Basic Architecture of and versions of SQL operations in SELECT statements.
SQL Server Server Lessons
• SQL Server Editions and • Describe how to use SQL • Introducing T-SQL
Versions Server Management • Understanding Sets
• Getting Started with SQL Studio (SSMS) to connect • Understanding Predicate
Server Management to an instance of SQL Logic
Studio Server, explore the • Understanding the Logical
Lab: Working with SQL Server databases contained in the Order of Operations in
Tools instance, and work with SELECT statements
• Working with SQL Server script files that contain T- Lab: Introduction to T-SQL Querying
Management Studio SQL queries • Executing Basic SELECT
• Creating and Organizing Statements
T-SQL Scripts
• Executing Queries that • Describe the use of • Explain how to limit ranges
Filter Data using column and table aliases of rows using the
Predicates • Understand and use CASE OFFSET-FETCH option of
• Executing Queries That expressions an ORDER BY clause
Sort Data Using ORDER • Explain how three-valued
BY Module 4: Querying Multiple logic accounts for
After completing this module, Tables unknown and missing
students will be able to: This module describes how to write values, how SQL Server
• Describe the role of T-SQL queries that combine data from uses NULL to mark
in writing SELECT multiple sources in Microsoft SQL missing values, and how to
statements Server. test for NULL in your
• Describe the elements of Lessons queries
the T-SQL language and • Understanding Joins
which elements will be • Querying with Inner Joins Module 6: Working with SQL
useful in writing queries • Querying with Outer Joins Server Data Types
• Describe the concepts of • Querying with Cross Joins This module introduces the data
the set theory, one of the and Self Joins types SQL Server uses to store
mathematical data.
Lab: Querying Multiple Tables
underpinnings of relational Lessons
• Writing Queries that use
databases, and to help you • Introducing SQL Server
Inner Joins
apply it to how you think Data Types
• Writing Queries that use
about querying SQL • Working with Character
Multiple-Table Inner Joins
Server Data
• Writing Queries that use
• Describe predicate logic • Working with Date and
Self-Joins
and examine its Time Data
• Writing Queries that use
application to querying Lab: Working with SQL Server Data
Outer Joins
SQL Server Types
• Writing Queries that use
• Explain the elements of a • Querying a cube using
Cross Joins
SELECT statement, MDX
After completing this module,
delineate the order in
students will be able to: • Creating a Calculated
which the elements are Member
evaluated, and then apply • Explain the fundamentals
of joins in SQL Server After completing this module,
this understanding to a students will be able to:
practical approach to • Write inner join queries
• Write queries that use • Use basic MDX functions
writing queries
outer joins • Use MDX to add
• Use additional join types calculations to a cube
Module 3: Writing SELECT
• Use MDX to query a cube
Queries
This module introduces the Module 5: Sorting and Filtering
fundamentals of the SELECT Data Module 7: Using DML to Modify
statement, focusing on queries This module describes how to Data
against a single table. implement sorting and filtering. This module describes how to
Lessons Lessons create DML queries, and why you
would want to.
• Writing Simple SELECT • Sorting Data
Lessons
Statements • Filtering Data with
• Inserting Data
• Eliminating Duplicates with Predicates
DISTINCT • Filtering Data with TOP • Modifying and Deleting
Data
• Using Column and Table and OFFSET-FETCH
Aliases • Working with Unknown Lab: Using DML to Modify Data
• Writing Simple CASE Values • Inserting Data
Expressions Lab: Sorting and Filtering Data • Updating and Deleting
Lab: Writing Basic SELECT • Writing Queries that Filter Data
Statements Data using a WHERE After completing this module,
• Writing Simple SELECT Clause students will be able to:
Statements • Writing Queries that Sort • Use INSERT and SELECT
• Eliminating Duplicates Data Using an ORDER BY INTO statements
Using DISTINCT Clause • Use UPDATE, MERGE,
• Using Column and Table • Writing Queries that Filter DELETE, and TRUNCATE
Aliases Data Using the TOP
• Using a Simple CASE Option Module 8: Using Built-In
Expression After completing this module, Functions
After completing this module, students will be able to: This module introduces some of the
students will be able to: • Explain how to add an many built in functions in SQL
Server.
• Describe the structure and ORDER BY clause to your
queries to control the order Lessons
format of the SELECT
statement, as well as of rows displayed in your • Writing Queries with Built-
enhancements that will query's output In Functions
add functionality and • Explain how to construct • Using Conversion
readability to your queries WHERE clauses to filter Functions
• Describe how to eliminate out rows that do not match • Using Logical Functions
duplicates using the the predicate • Using Functions to Work
DISTINCT clause • Explain how to limit ranges with NULL
of rows in the SELECT Lab: Using Built-In Functions
clause using a TOP option
• Writing Queries That Use Lab: Grouping and Aggregating work with their results as you would
Conversion Functions Data work with data in any valid relational
• Writing Queries that use • Writing Queries That Use table. Microsoft SQL Server
Logical Functions the GROUP BY Clause supports four types of table
• Writing Queries that Test • Writing Queries that Use expressions: derived tables,
for Nullability Aggregate Functions common table expression (CTEs),
After completing this module, • Writing Queries that Use views, and inline table-valued
students will be able to: Distinct Aggregate functions (TVFs). In this module,
you will learn to work with these
• Describe the types of Functions
• Writing Queries that Filter forms of table expressions and learn
functions provided by SQL
Groups with the HAVING how to use them to help create a
Server, and then focus on
Clause modular approach to writing
working with scalar
queries.
functions After completing this module,
Lessons
• Explain how to explicitly students will be able to:
• Using Views
convert data between • Describe the built-in
types using several SQL aggregate function in SQL • Using Inline Table-Valued
Server functions Server and write queries Functions
• Describe how to use using it • Using Derived Tables
logical functions that • Write queries that separate • Using Common Table
evaluate an expression rows using the GROUP BY Expressions
and return a scalar result clause Lab: Using Table Expressions
• Describe additional • Write queries that use the • Writing Queries That Use
functions for working with HAVING clause to filter Views
NULL groups • Writing Queries That Use
Derived Tables
Module 9: Grouping and Module 10: Using Subqueries • Writing Queries That Use
Aggregating Data This module describes several Common Table
This module describes how to use types of subquery and how and Expressions (CTEs)
aggregate functions. when to use them. • Writing Queries That Sue
Lessons Lessons Inline Table-Valued
• Using Aggregate • Writing Self-Contained Expressions
Functions Subqueries After completing this module,
• Using the GROUP BY • Writing Correlated students will be able to:
Clause Subqueries • Write queries that return
• Filtering Groups with • Using the EXISTS results from views
HAVING Predicate with Subqueries • Use the CREATE
Lab: Grouping and Aggregating Lab: Using Subqueries FUNCTION statement to
Data • Writing Queries That Use create simple inline TVFs
• Writing Queries That Use Self-Contained Subqueries • Write queries that create
the GROUP BY Clause • Writing Queries That Use and retrieve results from
• Writing Queries that Use Scalar and Multi-Result derived tables
Aggregate Functions Subqueries • Write queries that create
• Writing Queries that Use • Writing Queries That Use CTEs and return results
Distinct Aggregate Correlated Subqueries and from the table expression
Functions an EXISTS Clause
• Writing Queries that Filter After completing this module, Module 12: Using Set Operators
Groups with the HAVING students will be able to: This module introduces how to use
Clause • Describe where the set operators UNION,
After completing this module, INTERSECT, and EXCEPT to
subqueries may be used in
students will be able to: compare rows between two input
a SELECT statement
• sets.
Describe the built-in • Write queries that use
aggregate function in SQL Lessons
correlated subqueries in a
Server and write queries SELECT statement • Writing Queries with the
using it • Write queries that use UNION operator
• Write queries that separate EXISTS predicates in a • Using EXCEPT and
rows using the GROUP BY WHERE clause to test for INTERSECT
clause the existence of qualifying • Using APPLY
• Write queries that use the rows Lab: Using Set Operators
HAVING clause to filter • Use the EXISTS predicate • Writing Queries That Use
groups to efficiently check for the UNION Set Operators and
existence of rows in a UNION ALL
Module 9: Grouping and subquery • Writing Queries That Use
Aggregating Data CROSS APPLY and
This module describes how to use Module 11: Using Table OUTER APPLY Operators
aggregate functions. Expressions • Writing Queries That Use
Lessons Previously in this course, you the EXCEPT and
• Using Aggregate learned about using subqueries as INTERSECT Operators
Functions an expression that returned results After completing this module,
• Using the GROUP BY to an outer calling query. Like students will be able to:
Clause subqueries, table expressions are • Write queries that use
• Filtering Groups with query expressions, but table UNION to combine input
HAVING expressions extend this idea by sets
allowing you to name them and to
• Write queries that use • Writing Queries that use • Create a stored procedure
UNION ALL to combine the PIVOT Operator that accepts input
input sets • Writing Queries that use parameters
• Write queries that use the the UNPIVOT Operator • Describe how T-SQL can
EXCEPT operator to return • Writing Queries that use be dynamically
only rows in one set but the GROUPING SETS constructed
not another CUBE and ROLLUP • Write queries that use
• Write queries that use the Subclauses dynamic SQL
INTERSECT operator to After completing this module,
return only rows that are students will be able to: Module 16: Programming with T-
present in both sets • Describe how pivoting data SQL
• Write queries using the can be used in T-SQL This module describes how to
CROSS APPLY operator. queries enhance your T-SQL code with
• Write queries using the • Write queries that pivot programming elements.
OUTER APPLY operator data from rows to columns Lessons
using the PIVOT operator • T-SQL Programming
Module 13: Using Windows • Write queries that unpivot Elements
Ranking, Offset, and Aggregate data from columns back to • Controlling Program Flow
Functions rows using the UNPIVOT Lab: Programming with T-SQL
This module describes the benefits operator • Declaring Variables and
to using window functions. Restrict • Write queries using the Delimiting Batches
window functions to rows defined in GROUPING SETS • Using Control-Of-Flow
an OVER clause, including subclause Elements
partitions and frames. Write queries • Write queries that use • Using Variables in a
that use window functions to ROLLUP AND CUBE Dynamic SQL Statement
operate on a window of rows and • Write queries that use the • Using Synonyms
return ranking, aggregation, and GROUPING_ID function
offset comparison results. After completing this module,
Lessons students will be able to:
Module 15: Executing Stored • Describe how Microsoft
• Creating Windows with Procedures
OVER SQL Server treats
This module describes how to return collections of statements
• Exploring Window results by executing stored
Functions as batches
procedures. Pass parameters to
• Create and submit batches
Lab: Using Windows Ranking, procedures. Create simple stored
of T-SQL code for
Offset, and Aggregate Functions procedures that encapsulate a
execution by SQL Server
• Writing Queries that use SELECT statement. Construct and
• Describe how SQL Server
Ranking Functions execute dynamic SQL with EXEC
stores temporary objects
• Writing Queries that use and sp_executesql.
as variables
Offset Functions Lessons
• Write code that declares
• Writing Queries that use • Querying Data with Stored and assigns variables
Window Aggregate Procedures
• Create and invoke
Functions • Passing Parameters to synonyms
After completing this module, Stored procedures
• Describe the control-of-
students will be able to: • Creating Simple Stored flow elements in T-SQL
• Describe the T-SQL Procedures
• Write T-SQL code using
components used to define • Working with Dynamic IF...ELSE blocks
windows, and the SQL
• Write T-SQL code that
relationships between Lab: Executing Stored Procedures uses WHILE
them • Using the EXECUTE
• Write queries that use the statement to Invoke Stored Module 17: Implementing Error
OVER clause, with Procedures Handling
partitioning, ordering, and • Passing Parameters to This module introduces error
framing to define windows Stored procedures handling for T-SQL.
• Write queries that use • Executing System Stored Lessons
window aggregate Procedures • Implementing T-SQL error
functions After completing this module, handling
• Write queries that use students will be able to: • Implementing structured
window ranking functions • Describe stored exception handling
• Write queries that use procedures and their use. Lab: Implementing Error Handling
window offset functions • Write T-SQL statements • Redirecting errors with
that execute stored TRY/CATCH
Module 14: Pivoting and procedures to return data
Grouping Sets • Using THROW to pass an
• Write EXECUTE error message back to a
This module describes write queries statements that pass input
that pivot and unpivot result sets. client
parameters to stored
Write queries that specify multiple After completing this module,
procedures
groupings with grouping sets. students will be able to:
• Write T-SQL batches that
Lessons • Implement T-SQL error
prepare output parameters
• Writing Queries with and execute stored
handling
PIVOT and UNPIVOT procedures • Implement structured
• Working with Grouping • Use the CREATE
exception handling
Sets PROCEDURE statement
Lab: Pivoting and Grouping Sets to write a stored procedure Module 18: Implementing
Transactions
This module describes how to • Adding error handling to a • Create and manage
implement transactions. CATCH block transactions with
Lessons After completing this module, transaction control
• Transactions and the students will be able to: language (TCL)
database engines • Describe transactions and statements
• Controlling transactions the differences between • Use SET XACT_ABORT
Lab: Implementing Transactions batches and transactions to define SQL Servers
• Controlling transactions • Describe batches and how handling of transactions
with BEGIN, COMMIT, and they are handled by SQL outside TRY/CATCH
ROLLBACK Server blocks

Associated Certifications & Exam


This course prepares students to write Exam 70-761: Querying Data with Transact-SQL.
On successful completion of this course students will receive a Torque IT attendance certificate.

You might also like