Writing Analytic Queries for Business Intelligence

Session Detail:    Classroom 3 Day

This three-day instructor-led course is about writing TSQL queries for the purpose of database reporting, analysis, and business intelligence. Specifically, this course presents TSQL within the context of data analysis in other words, making meaning from the data rather than transaction-oriented data-tier application development. The course starts with a brief discussion of levels of measurement and quantitative research methodology and integrates these concepts into each TSQL topic presented. The goal is to provide a consistent, direct, and purposeful learning path from RDBMS data retrieval through analytical tools such as SQL Server Reporting Services, PowerBI, Excel, R, SAS, and SPSS.


  • Context knowledge of data analysis and business intelligence scenarios. For example, an understanding of a work-related business intelligence project or need.
  • Basic knowledge of the Windows operating system and its core functionality, including file system navigation.
  • Basic understanding of the purpose of relational database management systems such as SQL Server.

Who Can Benefit

This course is intended for information workers and data science professionals who seek to use database reporting and analysis tools such as Microsoft SQL Server Reporting Services, Excel, Power BI, R, SAS, and other business intelligence tools, and wish to use TSQL queries to efficiently retrieve data sets from Microsoft SQL Server relational databases for use with these tools.

Session Outline

Class Outline

Module 1: Introduction to TSQL for Business Intelligence

  • Lesson 1: Two Approaches to SQL Programming
  • Lesson 2: TSQL Data Retrieval in an Analytics / Business Intelligence Environment
  • Lesson 3: The Database Engine
  • Lesson 4: SQL Server Management Studio and the CarDeal Sample Database
  • Lesson 5: Identifying Variables in Tables
  • Lesson 6: SQL is a Declarative Language
  • Lesson 7: Introduction to the SELECT Query

After completing this module, students will be able to:

  • Describe the purpose of analytical queries
  • Describe the function of TSQL data retrieval in an analytics/business intelligence environment
  • Describe the primary functions of the database engine
  • Discuss TSQL as a declarative language
  • Identify variables of interest in database tables
  • Write basic SELECT queries

Module 2: Turning Table Columns into Variables for Analysis

  • Lesson 1: Turning Columns into Variables for Analysis
  • Lesson 2: Column Expressions, Data Types, and Built-in Functions
  • Lesson 3: Column aliases
  • Lesson 4: Data type conversions
  • Lesson 5: Built-in Scalar Functions
  • Lesson 6: Table Aliases
  • Lesson 7: The WHERE clause
  • Lesson 8: ORDER BY

After completing this module, students will be able to:

  • Implement column expressions in SELECT queries
  • Implement column and table aliases
  • Describe data types and Implement data type conversions
  • Implement built-in functions
  • Use WHERE and ORDER BY clauses in SELECT queries

Module 3: Combining Columns from Multiple Tables into a Single Dataset

  • Lesson 1: Primary Keys, Foreign Keys, and Joins
  • Lesson 2: Understanding Joins, Part 1: CROSS JOIN and the Full Cartesian Product
  • Lesson 3: Understanding Joins, Part 2: The INNER JOIN
  • Lesson 4: Understanding Joins, Part 3: The OUTER JOINS
  • Lesson 5: Understanding Joins, Part 4: Joining more than two tables
  • Lesson 6: Understanding Joins, Part 5: Combining INNER and OUTER JOINs
  • Lesson 7: Combining JOIN Operations with WHERE and ORDER BY

After completing this module, students will be able to:

  • Discuss and describe the conceptual flow of JOIN operations
  • Implement INNER and OUTER JOIN operations on two or more tables
  • Describe the order of operations of SELECT clauses
  • Combine JOIN operations with WHERE and ORDER BY

Module 4: Creating an Appropriate Aggregation Level Using GROUP BY

  • Lesson 1: Identifying the required aggregation level and granularity
  • Lesson 2: Aggregate Functions
  • Lesson 3: GROUP BY
  • Lesson 4: HAVING
  • Lesson 6: Order of operations in SELECT queries

After completing this module, students will be able to:

  • Describe row granularity of result sets
  • Discuss and implement aggregate functions to achieve required row granularity
  • Use GROUP BY to calculate aggregate values for groups
  • Use HAVING to filter records in the result set by the aggregate value
  • Combine GROUP BY and HAVING with WHERE and ORDER BY

Module 5: Subqueries, Derived Tables and Common Table Expressions

  • Lesson 1: Non-correlated and correlated subqueries
  • Lesson 2: Derived tables
  • Lesson 3: Common table expressions

After completing this module, students will be able to:

  • Describe and discuss the rationale of creating intermediate results sets within SELECT queries
  • Implement non-correlated and correlated subqueries
  • Implement derived tables
  • Implement Common Table Expressions
  • Create intermediate to advanced TSQL queries to retrieve result sets for analysis

Module 6: Encapsulating Data Retrieval Logic

  • Lesson 1: Views
  • Lesson 2: Table-valued functions
  • Lesson 3: Stored procedures
  • Lesson 4: Creating objects for read-access users
  • Lesson 5: Creating database accounts for analytical client tools

After completing this module, students will be able to:

  • Identify scenarios in which views, table-valued functions, and stored procedures simply data retrieval
  • Compare and contrast views, table-valued functions, and stored procedures
  • Create views, table-valued functions, and stored procedures
  • Describe the security requirement for creating database objects
  • Implement views, table-valued functions, and stored procedures for users with read-only access to source data

Module 7: Getting Your Dataset to the Client

  • Lesson 1: Connecting to SQL Server and Submitting Queries from Client Tools
  • Lesson 2: Connecting and running SELECT queries from:
  • Lesson 3: Excel
  • Lesson 4: PowerBI
  • Lesson 5: RStudio
  • Lesson 6: Exporting datasets to files using
  • Lesson 7: Results pane from SSMS
  • Lesson 8: The BCP utility
  • Lesson 9: The Import/Export Wizard

After completing this module, students will be able to:

  • Describe the properties of database connection strings
  • Run queries from, and return results to, Excel, PowerBI, and RStudio
  • Export query results to external text files using the SSMS results pane, the BCP utility, and the Import/Export Wizard

Need to train your team?

All of our sessions can be customized to meet your team’s specific needs. Build the perfect program by picking and choosing topics from any of the courses in our catalog. A personalized private session gives you the ultimate flexibility and helps maximize your team’s valuable time!

Requesting Team Training
DateTimeTypePriceAdd To Cart

Writing Analytic Queries for Business Intelligence

3 Day


Chat with a Coach

Chat with a Coach

Have a more immediate need? Why spend the next hour searching online for answers when you can spend just 15 minutes with one of our experts and get accurate and personalized answers to all of your questions. 

$9.99 | 15 Minutes

Book Now