Querying Data with Transact-SQL

Introduction

The main purpose of this 5-day instructor led  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.
The course will very likely be well attended by SQL power users who aren’t necessarily database-focused; namely, report writers, business analysts and client application developers.
 

Audience

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; namely, report writers, business analysts and client application developers.

Prerequisites

Before attending this course, participants should have:

 

  • Working knowledge of relational databases
  • Basic knowledge of the Microsoft Windows operating system and its core functionality

At course completion

After completing this course, students will be able to:
 
  • Describe the basic architecture and concepts of Microsoft SQL Server 2016
  • Understand the similarities and differences between Transact-SQL and other computer languages
  • Write SELECT queries
  • Query multiple tables
  • Sort and filter data
  • Describe the use of data types in SQL Server
  • Modify data using Transact-SQL
  • Use built-in functions
  • Group and aggregate data
  • Use subqueries
  • Use table expressions
  • Use set operators
  • Use window ranking, offset and aggregate functions
  • Implement pivoting and grouping sets
  • Execute stored procedures
  • Program with T-SQL
  • Implement error handling
  • Implement transactions

Exams

This course prepares to the exam 70-461.

Course outline

Module 1: Introduction to Microsoft SQL Server 2016
  • Lesson 1: The Basic Architecture of SQL Server
  • Lesson 2: SQL Server Editions and Versions
  • Lesson 3: Getting Started with SQL Server Management Studio

Module 2: Introduction to T-SQL Querying

  • Lesson 1: Introducing T-SQL
  • Lesson 2: Understanding Sets
  • Lesson 3: Understanding Predicate Logic
  • Lesson 4: Understanding the Logical Order of Operations in SELECT statements

Module 3 : Writing querying SELECT

  • Leçon 1 : Writing Simple SELECT Statements
  • Leçon 2 : Eliminating Duplicates with DISTINCT
  • Leçon 3 : Using Column and Table Aliases
  • Leçon 4 : Writing Simple CASE Expressions

Module 4: Querying Multiple Tables

  • Lesson 1: Understanding Joins
  • Lesson 2: Querying with Inner Joins
  • Lesson 3: Querying with Outer Joins
  • Lesson 4: Querying with Cross Joins and Self Joins

Module 5: Sorting and Filtering Data

  • Lesson 1: Sorting Data
  • Lesson 2: Filtering Data with Predicates
  • Lesson 3: Filtering Data with TOP and OFFSET-FETCH
  • Lesson 4: Working with Unknown Values

Module 6: Working with SQL Server 2016 Data Types

  • Lesson 1: Introducing SQL Server 2016 Data Types
  • Lesson 2: Working with Character Data
  • Lesson 3: Working with Date and Time Data

Module 7: Using DML to Modify Data

  • Lesson 1: Inserting Data
  • Lesson 2: Modifying and Deleting Data

Module 8: Using Built-In Functions

  • Lesson 1: Writing Queries with Built-In Functions
  • Lesson 2: Using Conversion Functions
  • Lesson 3: Using Logical Functions
  • Lesson 4: Using Functions to Work with NULL

Module 9: Grouping and Aggregating Data

  • Lesson 1: Using Aggregate Functions
  • Lesson 2: Using the GROUP BY Clause
  • Lesson 3: Filtering Groups with HAVING

Module 10: Using Subqueries

  • Lesson 1: Writing Self-Contained Subqueries
  • Lesson 2: Writing Correlated Subqueries
  • Lesson 3: Using the EXISTS Predicate with Subqueries

Module 11: Using Table Expressions

  • Lesson 1: Using Views
  • Lesson 2: Using Inline Table-Valued Functions
  • Lesson 3: Using Derived Tables
  • Lesson 4: Using Common Table Expressions

Module 12: Using Set Operators

  • Lesson 1: Writing Queries with the UNION operator
  • Lesson 2: Using EXCEPT and INTERSECT
  • Lesson 3: Using APPLY

Module 13: Using Windows Ranking, Offset, and Aggregate Functions
  • Lesson 1: Creating Windows with OVER
  • Lesson 2: Exploring Window Functions

Module 14: Pivoting and Grouping Sets

  • Lesson 1: Writing Queries with PIVOT and UNPIVOT
  • Lesson 2: Working with Grouping Sets

Module 15: Executing Stored Procedures

  • Lesson 1: Querying Data with Stored Procedures
  • Lesson 2: Passing Parameters to Stored procedures
  • Lesson 3: Creating Simple Stored Procedures
  • Lesson 4: Working with Dynamic SQL

Module 16: Programming with T-SQL

  • Lesson 1: T-SQL Programming Elements
  • Lesson 2: Controlling Program Flow

Module 17: Implementing Error Handling

  • Lesson 1: Implementing T-SQL error handling
  • Lesson 2: Implementing structured exception handling

Module 18: Implementing Transactions

  • Lesson 1: Transactions and the database engines
  • Lesson 2: Controlling transactions

Documentation

Microsoft Courseware Officiel (MOC) 20761

Cursus de certification

Exams 70461 + 70462 or 70463 = MCSA SQL Server 2012

Lab

Lab 1: Working with SQL Server 2016 Tools
Exercice 1.1: Introduction to T-SQL Querying

Lab 3: Writing SELECT Queries
Exercice 3.1: Writing Simple SELECT Statements
Exercice 3.2: Eliminating Duplicates Using DISTINCT
Exercice 3.3: Using Column and Table Aliases
Exercice 3.4: Using a Simple CASE Expression

Lab 4: Querying Multiple Tables
Exercice 4.1: Writing Queries that use Inner Joins
Exercice 4.2: Writing Queries that use Multiple-Table Inner Joins
Exercice 4.3: Writing Queries that use Self-Joins
Exercice 4.4: Writing Queries that use Outer Joins
Exercice 4.5: Writing Queries that use Cross Joins

Lab 5: Sorting and Filtering Data
Exercice 5.1: Writing Queries that Filter Data using a WHERE Clause
Exercice 5.2: Writing Queries that Sort Data Using an ORDER BY Clause
Exercice 5.3: Writing Queries that Filter Data Using the TOP Option

Lab 6: Working with SQL Server 2016 Data Types
Exercice 6.1: Writing Queries that Return Date and Time Data
Exercice 6.2: Writing Queries that use Date and Time Functions
Exercice 6.3: Writing Queries That Return Character Data
Exercice 6.4: Writing Queries That Return Character Functions

Lab 7: Using DML to Modify Data
Exercice 7.1: Inserting Data
Exercice 7.2: Updating and Deleting Data

Lab 8: Using Built-In Functions
Exercice 8.1: Writing Queries That Use Conversion Functions
Exercice 8.2: Writing Queries that use Logical Functions
Exercice 8.3: Writing Queries that Test for Nullability

Lab 9: Grouping and Aggregating Data
Exercice 9.1: Writing Queries That Use the GROUP BY Clause
Exercice 9.2: Writing Queries that Use Aggregate Functions
Exercice 9.3: Writing Queries that Use Distinct Aggregate Functions
Exercice 9.4: Writing Queries that Filter Groups with the HAVING Clause

Lab 10: Using Subqueries
Exercice 10.1: Writing Queries That Use Self-Contained Subqueries
Exercice 10.2: Writing Queries That Use Scalar and Multi-Result Subqueries
Exercice 10.3: Writing Queries That Use Correlated Subqueries and an EXISTS Clause

Lab 11: Using Table Expressions
Exercice 11.1: Writing Queries That Use Views
Exercice 11.2: Writing Queries That Use Derived Tables
Exercice 11.3: Writing Queries That Use Common Table Expressions (CTEs)
Exercice 11.4: Writing Queries That Sue Inline Table-Valued Expressions

Lab 12: Using Set Operators
Exercice 12.1: Writing Queries That Use UNION Set Operators and UNION ALL
Exercice 12.2: Writing Queries That Use CROSS APPLY and OUTER APPLY Operators
Exercice 12.3: Writing Queries That Use the EXCEPT and INTERSECT Operators

Lab 13: Using Windows Ranking, Offset, and Aggregate Functions
Exercice 13.1: Writing Queries that use Ranking Functions
Exercice 13.2: Writing Queries that use Offset Functions
Exercice 13.3: Writing Queries that use Window Aggregate Functions

Lab 14: Pivoting and Grouping Sets
Exercice 14.1: Writing Queries that use the PIVOT Operator
Exercice 14.2: Writing Queries that use the UNPIVOT Operator
Exercice 14.3: Writing Queries that use the GROUPING SETS CUBE and ROLLUP Subclauses

Lab 15: Executing Stored Procedures
Exercice 15.1: Using the EXECUTE statement to Invoke Stored Procedures
Exercice 15.2: Passing Parameters to Stored procedures
Exercice 15.2: Executing System Stored Procedures
Lab 15.2 : Programming with T-SQL
Exercice 15.2.1: Declaring Variables and Delimiting Batches
Exercice 15.2.2: Using Control-Of-Flow Elements
Exercice 15.2.3: Using Variables in a Dynamic SQL Statement
Exercice 15.2.4: Using Synonyms

Module 17: Implementing Error Handling
Exercice 17.1: Redirecting errors with TRY/CATCH
Exercice 17.2: Using THROW to pass an error message back to a client

Module 18: Implementing Transactions
Exercice 18.1: Controlling transactions with BEGIN, COMMIT, and ROLLBACK
Exercice 18.2: Adding error handling to a CATCH block
 

Formations complémentaires

Course 20462: Administering Microsoft® SQL Server® 2014
Course 20465: Designing Solutions for Microsoft SQL Server 2014
Course 20464: Developing Microsoft SQL Server 2014 Databases 2014