Learn how to use the ROW_NUMBER() windows function to generate a unique ID. Problem: You have a table named Teams with information

Read More
Use ROW_NUMBER to Create a Unique ID

Problem We want to compare two moving averages in SQL. We’ll use window functions to do this, as it is easier write

Read More
Compare Two Moving Averages in SQL

Problem You want to remove duplicates in SQL. You know it is easy to find duplicates using GROUP BY, but how do

Read More
Find and Remove Duplicates in SQL

Problem You need to find duplicates and then identify the records by their primary keys. Background Here’s an example of how to

Read More
How to Find Duplicates using a Windows Function?

Problem How do you create a moving average using windows functions in SQL? Background There is no built-in function to create a

Read More
Calculate a Moving Average in SQL using A Windows Function

Problem How do you create a running total on a column using SQL? Background There is no built-in function to create a

Read More
Calculate a Running Total in SQL using a Windows Function

Introduction Window functions are an essential tool for data analysis, particularly in the SQL language. They allow you to perform complex calculations,

Read More
Working with ROW_NUMBER, RANK, and DENSE_RANK

In this article let’s look at window functions vs GROUP BY queries. We’ll do so by looking at how each statement works

Read More
Window Functions vs Group By Queries?

In this article I’ll show you how to use STRING_SPLIT() to join two tables.  I call this the impossible join. I’ve come

Read More
How to do an Impossible Join with String Split

Sooner or later, you want to know when a column contains in SQL another value.  In this article we’ll go over several

Read More
Contains in SQL

Use SQL HAVING to filter summary results from a GROUP BY.  It specifies the search condition for the group or aggregate. SQL

Read More
SQL HAVING Tutorial

Use the SQL GROUP BY Clause is to consolidate like values into a single row.  The group is a set of columns. The group

Read More
SQL GROUP BY Guide

The SQL SUM function returns the total value within a table or group. In its simplest use, SUM() totals a column for all results and returns a

Read More
SQL SUM Function

In this article learn when to use WHERE and HAVING.  Both perform similar functions, but for different purposes! All the examples for

Read More
What is the difference between WHERE and HAVING clauses?

In this article you’ll learn to use the LIKE operator in your SQL. In most situations you’ll find yourself using LIKE within

Read More
SQL WHERE LIKE

In this video we’ll walk you though how to use the LIKE clause.   We’ll show you how to you can perform

Read More
How do I use the Like Clause in SQL Server?

In today’s lesson, you’re going to learn how to filter query results using the SQL WHERE clause.  This clause is important as

Read More
SQL WHERE – Guide and Examples

The SQL ORDER BY clause is used to sort your query result in ascending or descending order. Once you have written a

Read More
Use SQL ORDER BY to Sort Results

Both TOP and OFFSET & FETCH can be used to limit the number of rows returned.  OFFSET and FETCH can return similar

Read More
What is the Difference between TOP and OFFSET & Fetch?

In this article we explore the OFFSET and FETCH clauses.  OFFSET and FETCH are used in conjunction with the SELECT statement ORDER

Read More
Using OFFSET and FETCH with the ORDER BY clause

Some times you just need to use SQL TOP to reduce the number of rows shown in your result. This is handy

Read More
SQL TOP

You will learn how to query Microsoft SQL Server using the SQL SELECT statement in this series of lessons. Once you have

Read More
SQL SELECT

Its is easy to get confused between inner join vs outer join clauses. Both inner and outer joins are used to combine

Read More
Inner Join vs Outer Join Clauses

The SQL FULL JOIN combines results from a left and right outer join into one result.  Or in other words, it is an inner join including

Read More
SQL FULL Join

The SQL RIGHT JOIN Includes all rows from the Right table and those that match from the left.  For that doesn’t match from the right, NULL is returned in the

Read More
SQL Right Join