microsoft partner logo color
8113  Reviews star_rate star_rate star_rate star_rate star_half

Querying Microsoft SQL Server with Transact-SQL

This five-day instructor-led course is intended for IT professionals who wish to use the Transact-SQL language to query and configure Microsoft SQL Server. Students are typically database developers...

Read More
$3,095 USD
Course Code 55366
Duration 5 days
Available Formats Classroom

This five-day instructor-led course is intended for IT professionals who wish to use the Transact-SQL language to query and configure Microsoft SQL Server. Students are typically database developers and database administrators, but might also be Business Intelligence developers, report creators, or application developers. In this course, students learn how to query single tables, join data from multiple tables, filter and sort data, modify data, use procedures and functions, and implement error handling.

Skills Gained

  • Create single table SELECT queries
  • Create multiple table SELECT queries
  • Filter and sort data
  • Insert, update, and delete data
  • Query data using built-in functions
  • Create queries that aggregate data
  • Create subqueries
  • Create queries that use table expressions
  • Use UNION, INTERSECT, and EXCEPT on multiple sets of data
  • Implement window functions in queries
  • Use PIVOT and GROUPING SETS in queries
  • Use stored procedures in queries
  • Add error handling to queries
  • Use transactions in queries

Who Can Benefit

This course is intended for novice database developers, database administrators, Business Intelligence developers, report creators, and application developers who have an understanding of relational database concepts and have basic Windows navigation skills.

Prerequisites

  • Basic understanding of relational databases.
  • Basic Windows knowledge.

Course Details

Outline


Module 1: Introduction to Transact-SQL
This module explains how to write and execute simple Transact-SQL queries.
Lessons

  • What is Transact-SQL
  • The SELECT statement
  • The WHERE clause
  • Sorting results
  • Calculations
  • CASE expressions

Lab 1: Introduction to Transact-SQL
  • Run a query
  • Search for text strings
  • Sort the results
After completing this module, students will be able to:
  • Describe Transact-SQL
  • Write a SELECT statement
  • Write a WHERE clause
  • Sort results
  • Implement calculations
  • Add CASE expressions

Module 2: Joining tables with Transact-SQL
This module explains how to query multiple tables and join the results together in a single recordset.
Lessons
  • The JOIN clause
  • Inner joins
  • Outer joins
  • Self joins and cross joins

Lab 1: Joining tables with Transact-SQL
  • Query two tables
  • Query many tables
  • Implement an oute join
  • Implement a self join
  • Implement a cross join
After completing this module, students will be able to:
  • Describe the JOIN clause
  • Implement inner joins
  • Create a query with outer joins
  • Implement self joins and cross joins

Module 3: Filtering and sorting results
This module explains how to filter results to find specific records and how to sort the resulting recordset.
Lessons
  • Implement the ORDER BY clause
  • Filter data with the WHERE clause
  • Limit the number of rows returned by a query
  • Implement NULL logic

Lab 1: Filtering and sorting results
  • Filter data with a WHERE clause
  • Sort data with ORDER BY
  • Limit the number of rows returned by a query
After completing this module, students will be able to:
  • Implement the ORDER BY clause
  • Filter data with the WHERE clause
  • Limit the number of rows returned by a query
  • Implement NULL logic

Module 4: SQL Server data types
This module explains how SQL Server uses data types. Its essential to understand data types for comparing data and also for inserting and updating records.
Lessons
  • Understand data types?
  • Implement string data types
  • Implement temporal data types

Lab 1: SQL Server data types
  • Create queries with string data
  • Implement string functions
  • Create queries with temporal data
  • Implement temporal functions
After completing this module, students will be able to:
  • Understand data types?
  • Implement string data types
  • Implement temporal data types

Module 5: Inserting, updating and deleting data
This module explains how to use Transact-SQL Data Manipulation Language (DML) to inert, update and delete data.
Lessons
  • Insert new records
  • Update existing records
  • Delete data

Lab 1: Inserting, updating and deleting data
  • Insert new records
  • Update existing records
  • Delete data
After completing this module, students will be able to:
  • Insert new records
  • Update existing records
  • Delete data

Module 6: Using SQL Server functions with Transact-SQL
This module explains how to alter the output or search criteria with built-in functions.
Lessons
  • Understand function types in SQL Server
  • Convert data using functions
  • Implement logical functions
  • Work with NULL data using functions

Lab 1: Using SQL Server functions with Transact-SQL
  • Convert data using functions
  • Implement logical functions
  • Work with NULL data using functions
After completing this module, students will be able to:
  • Convert data using functions
  • Implement logical functions
  • Work with NULL data using functions

Module 7: Aggregating data with Transact-SQL
This module explains how to group matching data and then aggregate numeric values for these groupings.
Lessons
  • Implement aggregation in SQL Server
  • Group records in SQL Server
  • Filter aggregated data

Lab 1: Aggregating data with Transact-SQL
  • Implement aggregation in SQL Server
  • Group records in SQL Server
  • Filter aggregated data
After completing this module, students will be able to:
  • Implement aggregation in SQL Server
  • Group records in SQL Server
  • Filter aggregated data

Module 8: Implement subqueries with Transact-SQL
This module explains how to use the output from one query as the input to another query.
Lessons
  • Implement scalar and multi-valued sub-queries
  • Implement correlated subqueries
  • Implement existence checks with subqueries

Lab 1: Implement subqueries with Transact-SQL
  • Implement scalar and multi-valued sub-queries
  • Implement correlated subqueries
  • Implement existence checks with subqueries
After completing this module, students will be able to:
  • Implement scalar and multi-valued sub-queries
  • Implement correlated subqueries
  • Implement existence checks with subqueries

Module 9: Create queries that use table expressions
This module explains how to use table expressions to extend the capabilities of sub-queries. Table expressions essentially name the results of a sub-query and allow them to be referenced as if they were a table.
Lessons
  • Create views
  • Create table-valued functions
  • Implement derived tables
  • Implement common table expressions

Lab 1: Create queries that use table expressions
  • Create views
  • Create table-valued functions
  • Implement derived tables
  • Implement common table expressions
After completing this module, students will be able to:
  • Create views
  • Create table-valued functions
  • Implement derived tables
  • Implement common table expressions

Module 10: Use UNION, INTERSECT, EXCEPT and APPLY on multiple sets of data
This module explains how to combine the results of multiple queries rather than join them. In a simple UNION query both result sets are returned as one, with all the rows of each result set, but you can perform more complex operations and adjust how the multiple result sets interact.
Lessons
  • Write queries with the UNION operator
  • Write queries with the INTERSECT and EXCEPT operators
  • Write queries with the APPLY operator

Lab 1: Use UNION, INTERSECT, EXCEPT and APPLY on multiple sets of data
  • Write queries with the UNION operator
  • Write queries with the INTERSECT and EXCEPT operators
  • Write queries with the APPLY operator
After completing this module, students will be able to:
  • Write queries with the UNION operator
  • Write queries with the INTERSECT and EXCEPT operators
  • Write queries with the APPLY operator

Module 11: Implement window functions in queries
This module explains how to use windowing functions to create result sets with features, such as row numbers or running totals, that are complex or even impossible in traditional T-SQL.
Lessons
  • Understand window functions
  • Impement window functions

Lab 1: Implement window functions in queries
  • Implement window ranking functions
  • Implement window offset functions
  • Implement window aggregate functions
After completing this module, students will be able to:
  • Understand window functions
  • Impement window functions

Module 12: Use PIVOT and grouping sets in queries
This module explains how to change the otput of queries in more sophisticated ways. PIVOT enables you to change the orientation of recordsets and grouping sets allow you to apply multiple levels of aggregation.
Lessons
  • Implement PIVOT in queries
  • Implement grouping sets in queries

Lab 1: Use PIVOT and grouping sets in queries
  • Implement PIVOT in queries
  • Implement UNPIVOT in queries
  • Implement grouping sets in queries
After completing this module, students will be able to:
  • Implement PIVOT in queries
  • Implement grouping sets in queries

Module 13: Use stored procedures in queries
This module explains how to use existing stored procedures and to create simple stored procedures. Stored procedures are encapsulated blocks of T-SQL code that can return recordsets as well as insert, update and delete data.
Lessons
  • Query data with stored procedures
  • Interact with stored procedures using input and output parameters
  • Write simple stored procedures
  • Pass dynamic SQL to SQL Server

Lab 1: Use stored procedures in queries
  • Query data with stored procedures
  • Interact with stored procedures using input and output parameters
  • Write simple stored procedures
After completing this module, students will be able to:
  • Query data with stored procedures
  • Interact with stored procedures using input and output parameters
  • Write simple stored procedures

Module 14: Implement programming features in Transact-SQL
This module explains how to implement programming constructs seen in procedural programming languages such as loops and conditional execution.
Lessons
  • Understand T-SQL programming elements
  • Implement loops and conditions in T-SQL queries

Lab 1: Implement programming features in Transact-SQL
  • Implement variables in T-SQL
  • Implement loops and conditions in T-SQL
  • Implement variables in dynamic SQL statements
After completing this module, students will be able to:
  • Understand T-SQL programming elements
  • Implement loops and conditions in T-SQL queries

Module 15: Add error handling to queries
This module explains how to implement error handling in T-SQL. Some errors are inevitable, such as a date value being passed to a numeric field, but these errors can be handled and resolved with proper error handling.
Lessons
  • Understand SQL Server error handling
  • Implemet structured exception handling

Lab 1: Add error handling to queries
  • Implement structured exception handling
  • Pass errors to client applications
After completing this module, students will be able to:
  • Understand SQL Server error handling
  • Implemet structured exception handling

Module 16: Use transactions in queries
This module explains how to implement transactions to control how multiple connections to SQL Server interact with each other.
Lessons
  • Understand database transactions
  • Implement transactions in T-SQL

Lab 1: Use transactions in queries
  • Implement transactions in T-SQL
  • Combine transactions with error handling
After completing this module, students will be able to:
  • Understand database transactions
  • Implement transactions in T-SQL