Grumpy Old IT Guy/Beginning SQL Server TSQL Programming

Become a Grumpy IT Guy!

Subscribe for the latest news, freebies, podcasts and special sales subscriptions.

By signing up, you agree to receive email updates.

  • $29.99

Beginning SQL Server TSQL Programming

  • Course
  • 540 Lessons
  • 365-day access

You will learn skills that will enable you to assume the role of a TSQL Developer, specifically: Learn how to use SSMS Create Databases Create Tables Load and Maintain Tables Write Complex Queries Learn SQL Server built in functions Create stored procedures and TSQL batch script Everything you need to learn to become a SQL Server TSQL Developer!

Outline

Module 1 - Introduction

In this course, we will cover SQL Server implementation and programming essentials, including the fundamentals of Data Manipulation Language (DML), Data Declaration Language (DDL), and Data Control Language (DCL).

This free introductory module will show you what you can expect to learn and what each module contains.

By taking this course, you'll gain a solid foundation in the basics of database management, be able to navigate SQL Server Management Studio (SSMS), learn to execute queries, and create and manage databases, tables, views, and more.

Please check out this course to see what you can learn to become an expert SQL Server developer. Together, we'll unlock the power of SQL Server!

Each lesson includes several examples, demos, and a homework assignment to reinforce your learning. All example code is available at the end of the course outline so you can practice the concepts learned.

Lesson 1 - Introduction
Preview
Lesson 1 – Introduction Video
Preview
Topic 1 – Introduction
Preview
Topic 2 – Who is the Grumpy Old IT Guy?
Preview
Topic 3 – Objectives
Preview
Topic 4 – Course Overview
Preview
Topic 5 – SSMS
Preview
Topic 6 – TSQL DML
Preview
Topic 7 – DML Query Structure
Preview
Topic 8 – DDL
Preview
Topic 9 – DCL
Preview
Topic 10 – JOINS
Preview
Topic 11 – The ORDER BY Clause
Preview
Topic 12 – The GROUP BY Clause
Preview
Topic 13 – Aggregate Functions
Preview
Topic 14 – UNION
Topic 15 – String Functions
Preview
Topic 16 – Date Functions
Preview
Topic 17 – TSQL Programming
Topic 18 – Review
Preview
Introduction to TSQL script
Intro Quiz
Setup - Installing SQL Server and SSMS
Preview
GRUMPY PODCAST - INSTALLING SQL SERVER 2019
Preview
GRUMPY PODCAST - INSTALLING SSMS 2019
Preview
BEGINNING TSQL - SETUP ENVIRONMENT - START HERE
DISCLAIMER

Module 2 – Navigating SSMS

Welcome to module 2, SSMS.

This module discusses SSMS and the skills required to master SSMS.

By the end of this module, you will be able to understand and navigate the SSMS menu bar, execute queries, create databases, manage security credentials and user roles, and much more.

If you are unfamiliar with SQL Server Management Studio, we'll guide you through the essential tools in SSMS to help you get started.

As is the case for all the modules in this course, each lesson includes several examples, demos, and a homework assignment to reinforce your learning. All example code is available at the end of the course outline so you can practice the concepts learned.

Introduction
Preview
Introduction Video – Navigating SSMS
Preview
MODULE 02 - INTRO SSMS SCRIPT
Preview
Lesson 2 - Connection Management Description
Lesson 2 - Connection Management Video
Lesson 3 - Creating Databases Description
Lesson 3 - Creating Databases Video
Lesson 4 - Exploring Databases Description
Lesson 4 - Exploring Databases Video
Lesson 5 - Managing Tables Description
Lesson 5 – Managing SQL Server Database Tables Video
Lesson 6 – SQL Server Database View Management Description
Lesson 6 – SQL Server Database View Management View
Lesson 7 – SQL Server Programmability with TSQL Description
Lesson 7 – SQL Server Programmability with TSQL Video
Lesson 8 – Database Object Security Management Description
Lesson 8 – Database Object Security Management Video
Lesson 9 – Job Management and Scheduling with SQL Agent Description
Lesson 9 – Job Management and Scheduling with SQL Agent Video
Lesson 10 – Review Description
Preview
Lesson 10 – Review Video
Preview

Module 3 – DML, the Data Manipulation Language

In this module, you'll learn how to write efficient queries using the DML sub-language of TSQL. Hands-on exercises and real-world examples are included.

You will also learn to insert, modify, and delete data from database tables. After all, you need data to learn how to write queries!

As is the case for all the modules in this course, each lesson includes several examples, demos, and a homework assignment to reinforce your learning. All example code is available at the end of the course outline so you can practice the concepts learned.

Lesson 1 – Introduction Description
Preview
Lesson 1 - Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 1 - Quiz
Lesson 2 – The SELECT Clause Description
Lesson 2 – The SELECT Clause Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The FROM Clause Description
Lesson 3 - The FROM Clause Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – The WHERE Clause Description
Lesson 4 – The WHERE Clause Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The JOIN Clause Description
Lesson 5 - The JOIN Clause Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – The GROUP BY Clause Description
Lesson 6 – The GROUP BY Clause Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Aggregate Functions Description
Lesson 7 – Aggregate Functions Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – The HAVING Clause Description
Lesson 8 – The HAVING Clause Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – The ORDER BY Clause Description
Lesson 9 – The ORDER BY Clause Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – Managing Database Tables Description
Lesson 10 – Managing Database Tables Video
Lesson 10 - Demo TSQL Script
Lesson 10 - Quiz
Lesson 11 – The INSERT Command Description
Lesson 11 – INSERT Command Video
Lesson 11 - Demo TSQL Script
Lesson 11 - Bulk Insert CSV Data Example
Lesson 11 - Quiz
Lesson 12 – Quick Review Description
Lesson 12 – Quick Review Video
Lesson 12 - Demo TSQL Script
Lesson 12 - Quiz
Lesson 13 – More DML Commands Description
Lesson 13 – More DML Commands Video
Lesson 13 - Demo TSQL Script
Lesson 13 - Quiz
Lesson 14 – BACKUP Utility Description
Lesson 14 – BACKUP Utility Video
Lesson 14 - Demo TSQL Script
Lesson 14 - Quiz
Lesson 15 – RESTORE Utility Description
Lesson 15 – RESTORE Utility Video
Lesson 15 - Demo TSQL Script
Lesson 15 - Quiz
Lesson 16 – Module Review Description
Preview
Lesson 16 – Review Video
Preview

Module 4 – DDL, the Data Declaration Language

Welcome to module 4, DDL. In this module, you'll learn how to create and manage database objects, including tables, indexes, views, and many more programming components.

We'll cover the essentials of DDL syntax, best practices for designing database schemas, and basic strategies for optimizing performance. As with the other modules, hands-on tutorials and practical examples will give you the skills to build and maintain databases using T-SQL confidently.

Join us and take your first steps toward becoming a proficient SQL Server developer. You may also learn some basic DBA skills.

As usual, each module lesson includes several examples and demos, plus a homework assignment to reinforce learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Preview
Lesson 2 – The CREATE DATABASE Command
Lesson 2 – The CREATE DATABASE Command Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The CREATE TABLE Command
Lesson 3 – The CREATE TABLE Command Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – The CREATE VIEW Command
Lesson 4 – The CREATE VIEW Command Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The CREATE INDEX Command
Lesson 5 – The CREATE INDEX Command Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Introduction to Query Plans
Lesson 6 – Introduction to Query Plans Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Review
Lesson 7 – Review Video

Module 5 – DCL, the Data Control Language

Welcome to module 5, DCL.

In this module, we will examine security management within SQL Server, mastering the tools and techniques for controlling access to your database environment.

From creating and managing server logins, database logins, and passwords to assigning database roles and permissions, you'll learn how to protect your data and ensure regulatory compliance.

You'll gain hands-on experience securing SQL Server using DCL T-SQL commands through practical tutorials and real-world scenarios.

As usual, each module lesson includes several examples and demos, plus a homework assignment to reinforce learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Lesson 1 – Introduction Video
Lesson 1 - Demo TSQL Script
Lesson 1 - Quiz
Lesson 2 – DCL – Data Control Language
Lesson 2 – DCL – Data Control Language Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – Server Level LOGINS
Lesson 3 – Server Level LOGINS Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – Database Level USERS
Lesson 4 – Database Level USERS Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Server Roles
Lesson 5 – Server Roles Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Database Roles
Lesson 6 – Database Roles Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Application Roles
Lesson 7 – Application Roles Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Review
Preview
Lesson 8 – Review Video
Preview

Module 6 – Using JOINS in Queries

Welcome to module 6, JOINS.

In this module, you'll learn how to apply a series of operators to establish table relations.

We'll explore all the types of joins available in T-SQL, including inner joins, outer joins (left, right, and full outer, cross joins, and self-joins. Through comprehensive tutorials and hands-on exercises, you'll master the art of combining data from multiple tables to extract valuable insights.

Whether you are new to TSQL or looking to strengthen - your technical skills, this module will enhance the knowledge you need to write efficient and powerful T-SQL queries.

As usual, each module lesson includes several examples and demos, plus a homework assignment to reinforce learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 2 – Inner Join
Lesson 2 – Inner Join Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – Left Outer Join
Lesson 3 – Left Outer Join Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – Right Outer Join
Lesson 4 – Right Outer Join Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Cross Join
Lesson 5 – Cross Join Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Join Predicates and Operators
Lesson 6 – Join Predicates and Operators Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Using Multiple Join Operators
Lesson 7 – Using Multiple Join Operators Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Using a Join with a Function
Lesson 8 – Using a Join with a Function Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – Review
Preview
Lesson 9 – Review Video
Preview

Module 7 – The ORDER BY clause

Welcome to module 7, The ORDER BY clause.

In this module, you'll learn how to use the ORDER BY clause to sort the output of your queries in ascending or descending order and specify which row to start sorting the data and how many rows to include.

Through examples and hands-on demonstrations, we'll cover various scenarios and best practices for effectively leveraging the ORDER BY clause by learning how to effectively use it in your reports, queries, and scripts.

Each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 2 – The ORDER BY clause
Lesson 2 – The ORDER BY clause - Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – More ORDER BY
Lesson 3 – More ORDER BY Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – ORDER BY clause with CASE Blocks
Lesson 4 – ORDER BY clause with CASE Blocks Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Data Conversion Traps
Lesson 5 – Data Conversion Traps Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – ORDER BY with ROW
Lesson 6 – ORDER BY with ROW Video
Lesson 6 - Demo TSQL Script
Lesson 7 – ORDER BY with Parameters
Lesson 7 – ORDER BY with Parameters Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Review
Preview
Lesson 8 – Review Video
Preview

Module 8 – The GROUP BY clause

Welcome to module 8.

In this module, we explore how to apply the GROUP BY clause, a fundamental feature of SQL queries that groups rows based on specified columns. This clause is also used for queries that include one or more aggregate functions like sum() or average (). You will learn about these in the next module.

You'll learn how to use GROUP BY to aggregate data and perform operations like counting, summing, averaging, and more across groups.

We will demonstrate different use cases and scenarios that require the GROUP BY clause through a series of illustrative examples and interactive demos.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 2 – Introducing the Group By Clause
Lesson 2 – Introducing the Group By Clause Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – Group By and Having Clauses
Lesson 3 – Group By and Having Clauses Video
Lesson 3 - Demo TSQL Script
Lesson 4 – The Group By clause with ROLLUP
Lesson 4 – The Group By clause with ROLLUP Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Group By Clause with CUBE
Lesson 5 – Group By Clause with CUBE Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Group By with Grouping Sets
Lesson 6 – GROUP BY with GROUPING SETS Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Grouping Sets with Empty Groups
Lesson 7 – Grouping Sets with Empty Groups Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Review
Preview
Lesson 8 – Review Video
Preview

Module 9 – Aggregate Functions

Welcome to module 9, aggregate functions.

This module explores the built-in aggregate functions for summarizing and analyzing data in SQL queries.

You'll learn how to use aggregate functions such as SUM, AVG, COUNT, MIN, and MAX to perform calculations on groups of rows, extract valuable nuggets, and generate quality reports that your users will love.

Through hands-on examples and interactive demos, we'll explore various scenarios where aggregate functions lead, from simple calculations to complex data analysis tasks.

Each lesson includes a homework assignment to reinforce your learning, and you'll have access to all example code in the Grumpy Old IT Guy GitHub repository. Join us to master aggregate functions and level up your SQL skills!

We will demonstrate different use cases and scenarios requiring aggregate functions through illustrative examples and interactive demos.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 2 – The COUNT() Function
Lesson 2 – The COUNT() Function Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The SUM() Function
Lesson 3 – The SUM() Function Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – The MAX() Function
Lesson 4 – The MAX() Function Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The MIN() Function
Lesson 5 – The MIN() Function Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – The AVG() Function
Lesson 6 – The AVG() Function Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – The STDEV() & STDEVP Function
Lesson 7 – The STDEV() & STDEVP Function Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – The VAR() & VARP Function
Lesson 8 – The VAR() & VARP Function Video
Lesson 8 - Demo TSQL Script
Lesson 9 – MATH 101
Lesson 8 - Quiz
Lesson 9 – MATH 101 Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – Loading the Failure Tables
Lesson 10 – Loading the Failure Tables
Lesson 10a - Demo TSQL Script - loading Plant & Hobby Shop Tables
Lesson 10b - Demo TSQL Script - loading Hobby Shop transactions
Lesson 10 - Quiz
Lesson 11 – THE OVER() Clause
Lesson 11 – THE OVER() Clause Video
Lesson 11 - Demo TSQL Script
Lesson 11 - Quiz
Lesson 12 – Review
Preview
Lesson 12 – Review Video
Preview
Lesson 13 - Extra TSQL Files for loading tables
Lesson 13 - Demo TSQL Script - generate plant failure test data
Lesson 13 - Demo TSQL Script - Plant database, adding failure tables

Module 10 – UNION and UNION ALL

Welcome to module 10, the UNION clause, an essential operator for combining the results of multiple SELECT queries into a single result set.

You'll learn to use UNION to merge data from different tables or queries, remove duplicates, and manipulate complex data.

Through hands-on examples and interactive demos, we'll explore scenarios where the UNION clause solves critical programming requirements, from integrating data sources to generating comprehensive reports.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 2 – The PLANT database
Lesson 2 – The PLANT database Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The UNION Operator
Lesson 3 – The UNION Operator Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – UNION ALL
Lesson 4 – UNION ALL Video
Lesson 4 - Demo TSQL Script
Lesson 5 – UNION (without ALL)
Lesson 5 – UNION (without ALL) Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Review
Preview
Lesson 6 – Review Video
Preview

Module 11 – String Functions

Welcome to module 11, string functions.

We explore potent functions like CONCAT, SUBSTRING, CHARINDEX, and more, allowing you to manipulate and transform strings quickly. Through a series of hands-on examples and interactive demos, you'll learn how to extract substrings, concatenate strings, search for specific characters, and perform various string operations to meet your query requirements.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 2 – The LEN() Function
Lesson 2 – The LEN() Function Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The LEFT() Function
Lesson 3 – The LEFT() Function Video
Lesson 3 - Demo TSQL Script
LESSON 3 - Quiz
Lesson 4 – The RIGHT() Function
Lesson 4 – The RIGHT() Function Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The LTRIM() Function
Lesson 5 – The LTRIM() Function Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – The RTRIM() Function
Lesson 6 – The RTRIM() Function Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – The REPLACE() Function
Lesson 7 – The REPLACE() Function Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – The CHARINDEX() Function
Lesson 8 – The CHARINDEX() Function Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – The SUBSTRING() Function
Lesson 9 – The SUBSTRING() Function Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – The REVERSE() Function
Lesson 10 – The REVERSE() Function Video
Lesson 10 - Demo TSQL Script
Lesson 10 - Quiz
Lesson 11 – The CONCAT() Function
Lesson 11 – The CONCAT() Function Video
Lesson 11 - Demo TSQL Script
Lesson 11 - Quiz
Lesson 12 – The LOWER() Function
Lesson 12 – The LOWER() Function Video
Lesson 12 - Demo TSQL Script
Lesson 12 - Quiz
Lesson 13 – The UPPER() Function
Lesson 13 – The UPPER() Function Video
Lesson 13 - Demo TSQL Script
Lesson 13 - Quiz
Lesson 14 – The DIFFERENCE() Function
Lesson 14 – The DIFFERENCE() Function Video
Lesson 14- Demo TSQL Script
Lesson 14 - Quiz
Lesson 15 – The SOUNDEX() Function
Lesson 15 – The SOUNDEX() Function Video
Lesson 15 - Demo TSQL Script
Lesson 15 - Quiz
Lesson 16 – The STRING_SPLIT() Function
Lesson 16 – The STRING_SPLIT() Function Video
Lesson 16 - Demo TSQL Script
Lesson 16 - Quiz
Lesson 17 – Review Video
Preview
Lesson 17 – Review
Preview

Module 12 – Date Functions

Welcome to module 12, date functions.

In this module, we explore essential functions like DATEADD, DATEDIFF, DATEPART, and more, which enable you to manipulate and analyze dates quickly.

Through a series of hands-on examples and interactive demos, you'll learn to calculate date differences, extract date parts, perform date arithmetic, and handle various date-related tasks efficiently.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 2 – The GETDATE() Function
Lesson 2 – The GETDATE() Function Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The ISDATE() Function
Lesson 3 – The ISDATE() Function Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – The DATEADD() Function
Lesson 4 – The DATEADD() Function Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The DATEDIFF() Function
Lesson 5 – The DATEDIFF() Function Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – The DATEPART() Function
Lesson 6 – The DATEPART() Function Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – The DAY() Function
Lesson 7 – The DAY() Function Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – The MONTH() Function
Lesson 8 – The MONTH() Function Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – The YEAR() Function
Lesson 9 – The YEAR() Function Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – The EOMONTH() Function
Lesson 10 – The EOMONTH() Function Video
Lesson 10 - Demo TSQL Script
Lesson 10 - Quiz
Lesson 11 – Review
Preview
Lesson 11 – Review Video
Preview

Module 13 – TSQL Deep Dive

Welcome to module 13, TSQL deep dive!

This module explores batch processing, conditional logic, iterative loops, and advanced query techniques, such as case statements, cursors, stored procedures, functions, and common table expressions (CTEs).

You'll learn how to write efficient T-SQL code to manipulate data, implement business logic, and solve complex business requirements through short lessons, hands-on examples, and demos.

Each lesson includes practical exercises to reinforce your understanding.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 2 – Batch Concepts
Lesson 2 – Batch Concepts Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – Conditional Programming with IF-ELSE Blocks
Lesson 3 – Conditional Programming with IF-ELSE Blocks Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – WHILE Loops
Lesson 4 – WHILE Loops Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Using CASE Blocks
Lesson 5 – Using CASE Blocks Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Using CURSOR Blocks
Lesson 6 – Using CURSOR Blocks Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Stored Procedures
Lesson 7 – Stored Procedures Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Functions
Lesson 8 – Functions Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – CTE – Common Table Expressions
Lesson 9 – CTE – Common Table Expressions Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – Review
Preview
Lesson 10 – Review Video
Preview

Module 14 – Wrap Up

This module serves as a summary of the course. We embarked on a journey through SQL Server programming, including twelve lessons, examples, demos, and homework. This course had everything from mastering the basics of SQL Server Management Studio to delving deep into T-SQL programming with data manipulation, data declaration, and data control language.

We explored essential topics such as table joins, aggregate functions, UNION clause, string manipulation, date manipulation, batch processing, and advanced techniques like conditional logic, loops, stored procedures, functions,

We even covered the use of common table expressions (CTEs).

Each lesson included hands-on examples, demos, and practical exercises to reinforce your learning. Whether you are new to SQL or looking to sharpen your good coding standards skills, this course, when completed, will equip you with the skills and tools to master SQL Server TSQL programming.

Module 14 – Wrap Up Video
Preview

Lesson Homework Assignments

For your convenience this section contains pdf versions of the homework clips for each lesson.

BEGINNING TSQL - MODULE 2 - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 3 - DML - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 4 - DDL - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 5 - DCL - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 6 - JOINS - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 7 - ORDER BY - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 8 - GROUP BY - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 9 - AGGREGATE FUNCTIONS - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 10 - UNION - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 11 - STRING FUNCTIONS - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 12 - DATE FUNCTIONS - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 13 - TSQL DEEP DIVE - HOMEWORK PDF.pdf

Lesson Homework Templates

Here are the templates to get you started with a possible solution to the homework. You can try to solve the homework without the templates, but if you need some help starting, you can use these. The critical goal is to learn the material, so if you need help or cheat, use these templates. A good approach is to load the template in one query window and load the solution to the homework assignment in another query pane so if you get stuck; you can check out the solution.

MODULE 02 - SSMS HOMEWORK TEMPLATE_FINAL.sql
MODULE 03 - DML HOMEWORK TEMPLATE_FINAL.sql
MODULE 04 - DDL HOMEWORK TEMPLATE_FINAL.sql
MODULE 05 - DCL HOMEWORK TEMPLATE_FINAL.sql
MODULE 06 - JOINS HOMEWORK TEMPLATE_FINAL.sql
MODULE 07 - ORDER BY HOMEWORK TEMPLATE_FINAL.sql
MODULE 08 - GROUP BY HOMEWORK TEMPLATE_FINAL.sql
MODULE 09 - AGGREGATE HOMEWORK TEMPLATE_FINAL.sql
MODULE 10 - UNION HOMEWORK TEMPLATE - FINAL.sql
MODULE 11 - STRING HOMEWORK TEMPLATE - FINAL.sql
MODULE 12 - DATE HOMEWORK SOLUTION TEMPLATE - FINAL.sql
MODULE 13 - TSQL DEEP DIVEHOMEWORK TEMPLATE - FINAL.sql

Lesson Homework Solutions

In this section you will find the SQL Server TSQL files that contain the homework solutions for each module lesson. Compare your results with these and see if you can improve on my solutions.

MODULE 02 - SSMS HOMEWORK SOLUTIONS.sql
MODULE 03 -DML HOMEWORK SOLUTIONS.sql
MODULE 04 -DDL HOMEWORK SOLUTIONS.sql
MODULE 05 -DCL HOMEWORK SOLUTIONS.sql
MODULE 06 -JOINS HOMEWORK SOLUTIONS.sql
MODULE 07 - ORDER BY HOMEWORK SOLUTIONS.sql
MODULE 08 - GROUP BY HOMEWORK SOLUTIONS.sql
MODULE 09 - AGGREGATE HOMEWORK SOLUTIONS.sql
MODULE 10 - UNION HOMEWORK SOLUTIONS.sql
MODULE 12 - DATE HOMEWORK SOLUTIONS.sql
MODULE 11 - STRING HOMEWORK SOLUTIONS.sql
MODULE 13 - TSQL DEEP DIVE HOMEWORK SOLUTIONS.sql

Create Databases DDL

The files in this section you enable you to create the databases used in the course. Make sure you change any references to file folders to match the file and drive setup on your particular machine. Suggested file folder set ups are provided for setting up the PRIMARY, DATA and LOG folders for each database.

CREATE BANK DATABASE.sql
CREATE CUSTOMER DATABASE.sql
CREATE CUSTOMER_MASTER DATABASE.sql
CREATE CUSTOMER_SALES DATABASE.sql
CREATE HOBBY_SHOP DATABASE.sql
CREATE HUMAN_RESOURCES DATABASE.sql
CREATE INVENTORY DATABASE.sql
CREATE LOGISTICS DATABASE.sql
CREATE ORGANIZATION DATABASE.sql
CREATE PLANT 10 HW DATABASE.sql
CREATE PLANT DATABASE
CREATE PLANT M10 DATABASE.sql
CREATE SALES DATABASE.sql
CREATE SALES DW DATABASE.sql

Create Database Tables

This section contains the files required to create the tables, views, stored procedures and functions for each database.

CREATE BANK DATABASE TABLES.sql
CREATE CUSTOMER DATABASE TABLES.sql
CREATE CUSTOMER SALES DATABASE TABLES.sql
CREATE HOBBY SHOP DATABASE TABLES.sql
CREATE HUMAN RESOURCES SALES DATABASE TABLES.sql
CREATE INVENTORY DATABASE TABLES.sql
CREATE ORGANIZATION SALES DATABASE TABLES.sql
CREATE PLANT DATABASE TABLES.sql
CREATE PLANT M10 DATABASE TABLES.sql
CREATE PLANT M10 HW DATABASE TABLES.sql
CREATE SALES DW DATABASE TABLES.sql
CREATE SALES DATABASE TABLES.sql

Database Tables BCP files

This section contains all the zipped data files for each of the tables in each database. It also contains the BEGINNING_TSQL_DATABASES zip file, which can be used to set up a complete environment. The individual database zip files are available in case you want to refresh a single database.

BANK.zip
CUSTOMER.zip
HOBBY_SHOP.zip
CUSTOMER_SALES.zip
HUMAN_RESOURCES.zip
INVENTORY.zip
PLANT.zip
ORGANIZATION.zip
PLANT_M10.zip
PLANT_10_HW.zip
SALES.zip
SALES_DW.zip
BEGINNING_TSQL_DATABASES

BUG Fixes

Here you will see bug fixes to any lesson code or the scripts used to create the databases, tables and to load them.

BUG 01 - Existing databases on the students server cause load script to fail - 11/3/2025 - RESOLVED

Contents

Module 1 - Introduction

In this course, we will cover SQL Server implementation and programming essentials, including the fundamentals of Data Manipulation Language (DML), Data Declaration Language (DDL), and Data Control Language (DCL).

This free introductory module will show you what you can expect to learn and what each module contains.

By taking this course, you'll gain a solid foundation in the basics of database management, be able to navigate SQL Server Management Studio (SSMS), learn to execute queries, and create and manage databases, tables, views, and more.

Please check out this course to see what you can learn to become an expert SQL Server developer. Together, we'll unlock the power of SQL Server!

Each lesson includes several examples, demos, and a homework assignment to reinforce your learning. All example code is available at the end of the course outline so you can practice the concepts learned.

Lesson 1 - Introduction
Preview
Lesson 1 – Introduction Video
Preview
Topic 1 – Introduction
Preview
Topic 2 – Who is the Grumpy Old IT Guy?
Preview
Topic 3 – Objectives
Preview
Topic 4 – Course Overview
Preview
Topic 5 – SSMS
Preview
Topic 6 – TSQL DML
Preview
Topic 7 – DML Query Structure
Preview
Topic 8 – DDL
Preview
Topic 9 – DCL
Preview
Topic 10 – JOINS
Preview
Topic 11 – The ORDER BY Clause
Preview
Topic 12 – The GROUP BY Clause
Preview
Topic 13 – Aggregate Functions
Preview
Topic 14 – UNION
Topic 15 – String Functions
Preview
Topic 16 – Date Functions
Preview
Topic 17 – TSQL Programming
Topic 18 – Review
Preview
Introduction to TSQL script
Intro Quiz
Setup - Installing SQL Server and SSMS
Preview
GRUMPY PODCAST - INSTALLING SQL SERVER 2019
Preview
GRUMPY PODCAST - INSTALLING SSMS 2019
Preview
BEGINNING TSQL - SETUP ENVIRONMENT - START HERE
DISCLAIMER

Module 2 – Navigating SSMS

Welcome to module 2, SSMS.

This module discusses SSMS and the skills required to master SSMS.

By the end of this module, you will be able to understand and navigate the SSMS menu bar, execute queries, create databases, manage security credentials and user roles, and much more.

If you are unfamiliar with SQL Server Management Studio, we'll guide you through the essential tools in SSMS to help you get started.

As is the case for all the modules in this course, each lesson includes several examples, demos, and a homework assignment to reinforce your learning. All example code is available at the end of the course outline so you can practice the concepts learned.

Introduction
Preview
Introduction Video – Navigating SSMS
Preview
MODULE 02 - INTRO SSMS SCRIPT
Preview
Lesson 2 - Connection Management Description
Lesson 2 - Connection Management Video
Lesson 3 - Creating Databases Description
Lesson 3 - Creating Databases Video
Lesson 4 - Exploring Databases Description
Lesson 4 - Exploring Databases Video
Lesson 5 - Managing Tables Description
Lesson 5 – Managing SQL Server Database Tables Video
Lesson 6 – SQL Server Database View Management Description
Lesson 6 – SQL Server Database View Management View
Lesson 7 – SQL Server Programmability with TSQL Description
Lesson 7 – SQL Server Programmability with TSQL Video
Lesson 8 – Database Object Security Management Description
Lesson 8 – Database Object Security Management Video
Lesson 9 – Job Management and Scheduling with SQL Agent Description
Lesson 9 – Job Management and Scheduling with SQL Agent Video
Lesson 10 – Review Description
Preview
Lesson 10 – Review Video
Preview

Module 3 – DML, the Data Manipulation Language

In this module, you'll learn how to write efficient queries using the DML sub-language of TSQL. Hands-on exercises and real-world examples are included.

You will also learn to insert, modify, and delete data from database tables. After all, you need data to learn how to write queries!

As is the case for all the modules in this course, each lesson includes several examples, demos, and a homework assignment to reinforce your learning. All example code is available at the end of the course outline so you can practice the concepts learned.

Lesson 1 – Introduction Description
Preview
Lesson 1 - Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 1 - Quiz
Lesson 2 – The SELECT Clause Description
Lesson 2 – The SELECT Clause Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The FROM Clause Description
Lesson 3 - The FROM Clause Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – The WHERE Clause Description
Lesson 4 – The WHERE Clause Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The JOIN Clause Description
Lesson 5 - The JOIN Clause Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – The GROUP BY Clause Description
Lesson 6 – The GROUP BY Clause Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Aggregate Functions Description
Lesson 7 – Aggregate Functions Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – The HAVING Clause Description
Lesson 8 – The HAVING Clause Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – The ORDER BY Clause Description
Lesson 9 – The ORDER BY Clause Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – Managing Database Tables Description
Lesson 10 – Managing Database Tables Video
Lesson 10 - Demo TSQL Script
Lesson 10 - Quiz
Lesson 11 – The INSERT Command Description
Lesson 11 – INSERT Command Video
Lesson 11 - Demo TSQL Script
Lesson 11 - Bulk Insert CSV Data Example
Lesson 11 - Quiz
Lesson 12 – Quick Review Description
Lesson 12 – Quick Review Video
Lesson 12 - Demo TSQL Script
Lesson 12 - Quiz
Lesson 13 – More DML Commands Description
Lesson 13 – More DML Commands Video
Lesson 13 - Demo TSQL Script
Lesson 13 - Quiz
Lesson 14 – BACKUP Utility Description
Lesson 14 – BACKUP Utility Video
Lesson 14 - Demo TSQL Script
Lesson 14 - Quiz
Lesson 15 – RESTORE Utility Description
Lesson 15 – RESTORE Utility Video
Lesson 15 - Demo TSQL Script
Lesson 15 - Quiz
Lesson 16 – Module Review Description
Preview
Lesson 16 – Review Video
Preview

Module 4 – DDL, the Data Declaration Language

Welcome to module 4, DDL. In this module, you'll learn how to create and manage database objects, including tables, indexes, views, and many more programming components.

We'll cover the essentials of DDL syntax, best practices for designing database schemas, and basic strategies for optimizing performance. As with the other modules, hands-on tutorials and practical examples will give you the skills to build and maintain databases using T-SQL confidently.

Join us and take your first steps toward becoming a proficient SQL Server developer. You may also learn some basic DBA skills.

As usual, each module lesson includes several examples and demos, plus a homework assignment to reinforce learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Preview
Lesson 2 – The CREATE DATABASE Command
Lesson 2 – The CREATE DATABASE Command Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The CREATE TABLE Command
Lesson 3 – The CREATE TABLE Command Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – The CREATE VIEW Command
Lesson 4 – The CREATE VIEW Command Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The CREATE INDEX Command
Lesson 5 – The CREATE INDEX Command Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Introduction to Query Plans
Lesson 6 – Introduction to Query Plans Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Review
Lesson 7 – Review Video

Module 5 – DCL, the Data Control Language

Welcome to module 5, DCL.

In this module, we will examine security management within SQL Server, mastering the tools and techniques for controlling access to your database environment.

From creating and managing server logins, database logins, and passwords to assigning database roles and permissions, you'll learn how to protect your data and ensure regulatory compliance.

You'll gain hands-on experience securing SQL Server using DCL T-SQL commands through practical tutorials and real-world scenarios.

As usual, each module lesson includes several examples and demos, plus a homework assignment to reinforce learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Lesson 1 – Introduction Video
Lesson 1 - Demo TSQL Script
Lesson 1 - Quiz
Lesson 2 – DCL – Data Control Language
Lesson 2 – DCL – Data Control Language Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – Server Level LOGINS
Lesson 3 – Server Level LOGINS Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – Database Level USERS
Lesson 4 – Database Level USERS Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Server Roles
Lesson 5 – Server Roles Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Database Roles
Lesson 6 – Database Roles Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Application Roles
Lesson 7 – Application Roles Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Review
Preview
Lesson 8 – Review Video
Preview

Module 6 – Using JOINS in Queries

Welcome to module 6, JOINS.

In this module, you'll learn how to apply a series of operators to establish table relations.

We'll explore all the types of joins available in T-SQL, including inner joins, outer joins (left, right, and full outer, cross joins, and self-joins. Through comprehensive tutorials and hands-on exercises, you'll master the art of combining data from multiple tables to extract valuable insights.

Whether you are new to TSQL or looking to strengthen - your technical skills, this module will enhance the knowledge you need to write efficient and powerful T-SQL queries.

As usual, each module lesson includes several examples and demos, plus a homework assignment to reinforce learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 2 – Inner Join
Lesson 2 – Inner Join Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – Left Outer Join
Lesson 3 – Left Outer Join Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – Right Outer Join
Lesson 4 – Right Outer Join Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Cross Join
Lesson 5 – Cross Join Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Join Predicates and Operators
Lesson 6 – Join Predicates and Operators Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Using Multiple Join Operators
Lesson 7 – Using Multiple Join Operators Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Using a Join with a Function
Lesson 8 – Using a Join with a Function Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – Review
Preview
Lesson 9 – Review Video
Preview

Module 7 – The ORDER BY clause

Welcome to module 7, The ORDER BY clause.

In this module, you'll learn how to use the ORDER BY clause to sort the output of your queries in ascending or descending order and specify which row to start sorting the data and how many rows to include.

Through examples and hands-on demonstrations, we'll cover various scenarios and best practices for effectively leveraging the ORDER BY clause by learning how to effectively use it in your reports, queries, and scripts.

Each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 2 – The ORDER BY clause
Lesson 2 – The ORDER BY clause - Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – More ORDER BY
Lesson 3 – More ORDER BY Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – ORDER BY clause with CASE Blocks
Lesson 4 – ORDER BY clause with CASE Blocks Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Data Conversion Traps
Lesson 5 – Data Conversion Traps Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – ORDER BY with ROW
Lesson 6 – ORDER BY with ROW Video
Lesson 6 - Demo TSQL Script
Lesson 7 – ORDER BY with Parameters
Lesson 7 – ORDER BY with Parameters Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Review
Preview
Lesson 8 – Review Video
Preview

Module 8 – The GROUP BY clause

Welcome to module 8.

In this module, we explore how to apply the GROUP BY clause, a fundamental feature of SQL queries that groups rows based on specified columns. This clause is also used for queries that include one or more aggregate functions like sum() or average (). You will learn about these in the next module.

You'll learn how to use GROUP BY to aggregate data and perform operations like counting, summing, averaging, and more across groups.

We will demonstrate different use cases and scenarios that require the GROUP BY clause through a series of illustrative examples and interactive demos.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 2 – Introducing the Group By Clause
Lesson 2 – Introducing the Group By Clause Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – Group By and Having Clauses
Lesson 3 – Group By and Having Clauses Video
Lesson 3 - Demo TSQL Script
Lesson 4 – The Group By clause with ROLLUP
Lesson 4 – The Group By clause with ROLLUP Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Group By Clause with CUBE
Lesson 5 – Group By Clause with CUBE Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Group By with Grouping Sets
Lesson 6 – GROUP BY with GROUPING SETS Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Grouping Sets with Empty Groups
Lesson 7 – Grouping Sets with Empty Groups Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Review
Preview
Lesson 8 – Review Video
Preview

Module 9 – Aggregate Functions

Welcome to module 9, aggregate functions.

This module explores the built-in aggregate functions for summarizing and analyzing data in SQL queries.

You'll learn how to use aggregate functions such as SUM, AVG, COUNT, MIN, and MAX to perform calculations on groups of rows, extract valuable nuggets, and generate quality reports that your users will love.

Through hands-on examples and interactive demos, we'll explore various scenarios where aggregate functions lead, from simple calculations to complex data analysis tasks.

Each lesson includes a homework assignment to reinforce your learning, and you'll have access to all example code in the Grumpy Old IT Guy GitHub repository. Join us to master aggregate functions and level up your SQL skills!

We will demonstrate different use cases and scenarios requiring aggregate functions through illustrative examples and interactive demos.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

All example code is available at the end of the course outline.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 2 – The COUNT() Function
Lesson 2 – The COUNT() Function Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The SUM() Function
Lesson 3 – The SUM() Function Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – The MAX() Function
Lesson 4 – The MAX() Function Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The MIN() Function
Lesson 5 – The MIN() Function Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – The AVG() Function
Lesson 6 – The AVG() Function Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – The STDEV() & STDEVP Function
Lesson 7 – The STDEV() & STDEVP Function Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – The VAR() & VARP Function
Lesson 8 – The VAR() & VARP Function Video
Lesson 8 - Demo TSQL Script
Lesson 9 – MATH 101
Lesson 8 - Quiz
Lesson 9 – MATH 101 Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – Loading the Failure Tables
Lesson 10 – Loading the Failure Tables
Lesson 10a - Demo TSQL Script - loading Plant & Hobby Shop Tables
Lesson 10b - Demo TSQL Script - loading Hobby Shop transactions
Lesson 10 - Quiz
Lesson 11 – THE OVER() Clause
Lesson 11 – THE OVER() Clause Video
Lesson 11 - Demo TSQL Script
Lesson 11 - Quiz
Lesson 12 – Review
Preview
Lesson 12 – Review Video
Preview
Lesson 13 - Extra TSQL Files for loading tables
Lesson 13 - Demo TSQL Script - generate plant failure test data
Lesson 13 - Demo TSQL Script - Plant database, adding failure tables

Module 10 – UNION and UNION ALL

Welcome to module 10, the UNION clause, an essential operator for combining the results of multiple SELECT queries into a single result set.

You'll learn to use UNION to merge data from different tables or queries, remove duplicates, and manipulate complex data.

Through hands-on examples and interactive demos, we'll explore scenarios where the UNION clause solves critical programming requirements, from integrating data sources to generating comprehensive reports.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 2 – The PLANT database
Lesson 2 – The PLANT database Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The UNION Operator
Lesson 3 – The UNION Operator Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – UNION ALL
Lesson 4 – UNION ALL Video
Lesson 4 - Demo TSQL Script
Lesson 5 – UNION (without ALL)
Lesson 5 – UNION (without ALL) Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Review
Preview
Lesson 6 – Review Video
Preview

Module 11 – String Functions

Welcome to module 11, string functions.

We explore potent functions like CONCAT, SUBSTRING, CHARINDEX, and more, allowing you to manipulate and transform strings quickly. Through a series of hands-on examples and interactive demos, you'll learn how to extract substrings, concatenate strings, search for specific characters, and perform various string operations to meet your query requirements.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 2 – The LEN() Function
Lesson 2 – The LEN() Function Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The LEFT() Function
Lesson 3 – The LEFT() Function Video
Lesson 3 - Demo TSQL Script
LESSON 3 - Quiz
Lesson 4 – The RIGHT() Function
Lesson 4 – The RIGHT() Function Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The LTRIM() Function
Lesson 5 – The LTRIM() Function Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – The RTRIM() Function
Lesson 6 – The RTRIM() Function Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – The REPLACE() Function
Lesson 7 – The REPLACE() Function Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – The CHARINDEX() Function
Lesson 8 – The CHARINDEX() Function Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – The SUBSTRING() Function
Lesson 9 – The SUBSTRING() Function Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – The REVERSE() Function
Lesson 10 – The REVERSE() Function Video
Lesson 10 - Demo TSQL Script
Lesson 10 - Quiz
Lesson 11 – The CONCAT() Function
Lesson 11 – The CONCAT() Function Video
Lesson 11 - Demo TSQL Script
Lesson 11 - Quiz
Lesson 12 – The LOWER() Function
Lesson 12 – The LOWER() Function Video
Lesson 12 - Demo TSQL Script
Lesson 12 - Quiz
Lesson 13 – The UPPER() Function
Lesson 13 – The UPPER() Function Video
Lesson 13 - Demo TSQL Script
Lesson 13 - Quiz
Lesson 14 – The DIFFERENCE() Function
Lesson 14 – The DIFFERENCE() Function Video
Lesson 14- Demo TSQL Script
Lesson 14 - Quiz
Lesson 15 – The SOUNDEX() Function
Lesson 15 – The SOUNDEX() Function Video
Lesson 15 - Demo TSQL Script
Lesson 15 - Quiz
Lesson 16 – The STRING_SPLIT() Function
Lesson 16 – The STRING_SPLIT() Function Video
Lesson 16 - Demo TSQL Script
Lesson 16 - Quiz
Lesson 17 – Review Video
Preview
Lesson 17 – Review
Preview

Module 12 – Date Functions

Welcome to module 12, date functions.

In this module, we explore essential functions like DATEADD, DATEDIFF, DATEPART, and more, which enable you to manipulate and analyze dates quickly.

Through a series of hands-on examples and interactive demos, you'll learn to calculate date differences, extract date parts, perform date arithmetic, and handle various date-related tasks efficiently.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 1 - Demo TSQL Script
Lesson 2 – The GETDATE() Function
Lesson 2 – The GETDATE() Function Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – The ISDATE() Function
Lesson 3 – The ISDATE() Function Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – The DATEADD() Function
Lesson 4 – The DATEADD() Function Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – The DATEDIFF() Function
Lesson 5 – The DATEDIFF() Function Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – The DATEPART() Function
Lesson 6 – The DATEPART() Function Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – The DAY() Function
Lesson 7 – The DAY() Function Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – The MONTH() Function
Lesson 8 – The MONTH() Function Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – The YEAR() Function
Lesson 9 – The YEAR() Function Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – The EOMONTH() Function
Lesson 10 – The EOMONTH() Function Video
Lesson 10 - Demo TSQL Script
Lesson 10 - Quiz
Lesson 11 – Review
Preview
Lesson 11 – Review Video
Preview

Module 13 – TSQL Deep Dive

Welcome to module 13, TSQL deep dive!

This module explores batch processing, conditional logic, iterative loops, and advanced query techniques, such as case statements, cursors, stored procedures, functions, and common table expressions (CTEs).

You'll learn how to write efficient T-SQL code to manipulate data, implement business logic, and solve complex business requirements through short lessons, hands-on examples, and demos.

Each lesson includes practical exercises to reinforce your understanding.

As usual, each lesson includes several examples and demos, plus a homework assignment to reinforce your learning.

Lesson 1 – Introduction
Preview
Lesson 1 – Introduction Video
Preview
Lesson 2 – Batch Concepts
Lesson 2 – Batch Concepts Video
Lesson 2 - Demo TSQL Script
Lesson 2 - Quiz
Lesson 3 – Conditional Programming with IF-ELSE Blocks
Lesson 3 – Conditional Programming with IF-ELSE Blocks Video
Lesson 3 - Demo TSQL Script
Lesson 3 - Quiz
Lesson 4 – WHILE Loops
Lesson 4 – WHILE Loops Video
Lesson 4 - Demo TSQL Script
Lesson 4 - Quiz
Lesson 5 – Using CASE Blocks
Lesson 5 – Using CASE Blocks Video
Lesson 5 - Demo TSQL Script
Lesson 5 - Quiz
Lesson 6 – Using CURSOR Blocks
Lesson 6 – Using CURSOR Blocks Video
Lesson 6 - Demo TSQL Script
Lesson 6 - Quiz
Lesson 7 – Stored Procedures
Lesson 7 – Stored Procedures Video
Lesson 7 - Demo TSQL Script
Lesson 7 - Quiz
Lesson 8 – Functions
Lesson 8 – Functions Video
Lesson 8 - Demo TSQL Script
Lesson 8 - Quiz
Lesson 9 – CTE – Common Table Expressions
Lesson 9 – CTE – Common Table Expressions Video
Lesson 9 - Demo TSQL Script
Lesson 9 - Quiz
Lesson 10 – Review
Preview
Lesson 10 – Review Video
Preview

Module 14 – Wrap Up

This module serves as a summary of the course. We embarked on a journey through SQL Server programming, including twelve lessons, examples, demos, and homework. This course had everything from mastering the basics of SQL Server Management Studio to delving deep into T-SQL programming with data manipulation, data declaration, and data control language.

We explored essential topics such as table joins, aggregate functions, UNION clause, string manipulation, date manipulation, batch processing, and advanced techniques like conditional logic, loops, stored procedures, functions,

We even covered the use of common table expressions (CTEs).

Each lesson included hands-on examples, demos, and practical exercises to reinforce your learning. Whether you are new to SQL or looking to sharpen your good coding standards skills, this course, when completed, will equip you with the skills and tools to master SQL Server TSQL programming.

Module 14 – Wrap Up Video
Preview

Lesson Homework Assignments

For your convenience this section contains pdf versions of the homework clips for each lesson.

BEGINNING TSQL - MODULE 2 - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 3 - DML - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 4 - DDL - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 5 - DCL - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 6 - JOINS - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 7 - ORDER BY - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 8 - GROUP BY - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 9 - AGGREGATE FUNCTIONS - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 10 - UNION - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 11 - STRING FUNCTIONS - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 12 - DATE FUNCTIONS - HOMEWORK PDF.pdf
BEGINNING TSQL - MODULE 13 - TSQL DEEP DIVE - HOMEWORK PDF.pdf

Lesson Homework Templates

Here are the templates to get you started with a possible solution to the homework. You can try to solve the homework without the templates, but if you need some help starting, you can use these. The critical goal is to learn the material, so if you need help or cheat, use these templates. A good approach is to load the template in one query window and load the solution to the homework assignment in another query pane so if you get stuck; you can check out the solution.

MODULE 02 - SSMS HOMEWORK TEMPLATE_FINAL.sql
MODULE 03 - DML HOMEWORK TEMPLATE_FINAL.sql
MODULE 04 - DDL HOMEWORK TEMPLATE_FINAL.sql
MODULE 05 - DCL HOMEWORK TEMPLATE_FINAL.sql
MODULE 06 - JOINS HOMEWORK TEMPLATE_FINAL.sql
MODULE 07 - ORDER BY HOMEWORK TEMPLATE_FINAL.sql
MODULE 08 - GROUP BY HOMEWORK TEMPLATE_FINAL.sql
MODULE 09 - AGGREGATE HOMEWORK TEMPLATE_FINAL.sql
MODULE 10 - UNION HOMEWORK TEMPLATE - FINAL.sql
MODULE 11 - STRING HOMEWORK TEMPLATE - FINAL.sql
MODULE 12 - DATE HOMEWORK SOLUTION TEMPLATE - FINAL.sql
MODULE 13 - TSQL DEEP DIVEHOMEWORK TEMPLATE - FINAL.sql

Lesson Homework Solutions

In this section you will find the SQL Server TSQL files that contain the homework solutions for each module lesson. Compare your results with these and see if you can improve on my solutions.

MODULE 02 - SSMS HOMEWORK SOLUTIONS.sql
MODULE 03 -DML HOMEWORK SOLUTIONS.sql
MODULE 04 -DDL HOMEWORK SOLUTIONS.sql
MODULE 05 -DCL HOMEWORK SOLUTIONS.sql
MODULE 06 -JOINS HOMEWORK SOLUTIONS.sql
MODULE 07 - ORDER BY HOMEWORK SOLUTIONS.sql
MODULE 08 - GROUP BY HOMEWORK SOLUTIONS.sql
MODULE 09 - AGGREGATE HOMEWORK SOLUTIONS.sql
MODULE 10 - UNION HOMEWORK SOLUTIONS.sql
MODULE 12 - DATE HOMEWORK SOLUTIONS.sql
MODULE 11 - STRING HOMEWORK SOLUTIONS.sql
MODULE 13 - TSQL DEEP DIVE HOMEWORK SOLUTIONS.sql

Create Databases DDL

The files in this section you enable you to create the databases used in the course. Make sure you change any references to file folders to match the file and drive setup on your particular machine. Suggested file folder set ups are provided for setting up the PRIMARY, DATA and LOG folders for each database.

CREATE BANK DATABASE.sql
CREATE CUSTOMER DATABASE.sql
CREATE CUSTOMER_MASTER DATABASE.sql
CREATE CUSTOMER_SALES DATABASE.sql
CREATE HOBBY_SHOP DATABASE.sql
CREATE HUMAN_RESOURCES DATABASE.sql
CREATE INVENTORY DATABASE.sql
CREATE LOGISTICS DATABASE.sql
CREATE ORGANIZATION DATABASE.sql
CREATE PLANT 10 HW DATABASE.sql
CREATE PLANT DATABASE
CREATE PLANT M10 DATABASE.sql
CREATE SALES DATABASE.sql
CREATE SALES DW DATABASE.sql

Create Database Tables

This section contains the files required to create the tables, views, stored procedures and functions for each database.

CREATE BANK DATABASE TABLES.sql
CREATE CUSTOMER DATABASE TABLES.sql
CREATE CUSTOMER SALES DATABASE TABLES.sql
CREATE HOBBY SHOP DATABASE TABLES.sql
CREATE HUMAN RESOURCES SALES DATABASE TABLES.sql
CREATE INVENTORY DATABASE TABLES.sql
CREATE ORGANIZATION SALES DATABASE TABLES.sql
CREATE PLANT DATABASE TABLES.sql
CREATE PLANT M10 DATABASE TABLES.sql
CREATE PLANT M10 HW DATABASE TABLES.sql
CREATE SALES DW DATABASE TABLES.sql
CREATE SALES DATABASE TABLES.sql

Database Tables BCP files

This section contains all the zipped data files for each of the tables in each database. It also contains the BEGINNING_TSQL_DATABASES zip file, which can be used to set up a complete environment. The individual database zip files are available in case you want to refresh a single database.

BANK.zip
CUSTOMER.zip
HOBBY_SHOP.zip
CUSTOMER_SALES.zip
HUMAN_RESOURCES.zip
INVENTORY.zip
PLANT.zip
ORGANIZATION.zip
PLANT_M10.zip
PLANT_10_HW.zip
SALES.zip
SALES_DW.zip
BEGINNING_TSQL_DATABASES

BUG Fixes

Here you will see bug fixes to any lesson code or the scripts used to create the databases, tables and to load them.

BUG 01 - Existing databases on the students server cause load script to fail - 11/3/2025 - RESOLVED