Recursive CTEs Explained
Recursive CTE’s In this article we explore recursive CTE’s (Common Table Expressions). Recursive CTEs are special in the sense they are allowed to reference themselves! Because of this special...
View ArticleCalculate the Last Day of the Month using SQL
When working with SQL dates, sometimes you need to calculate the end of the month. Months are tricky! Some are 28 days, others 30 or 31, and now and then there’s a leap year! So, given a date, how do...
View ArticleUncommon SQL Server Data Types
In this article we’re going to go over a uncommon SQL server data types. These are those you won’t use every day, but you’ll want to know if you take the 70-461 exam. Even if you don’t plan on taking...
View ArticleLearn How to Combine Data with a CROSS JOIN
A cross join is used when you wish to create combination of every row from two tables. All row combinations are included in the result; this is commonly called cross product join. A common use for a...
View ArticleLearn how to Add, Remove, or Modify values in a SQL Table
In this article we’ll discover data modification statements used to modify data in SQL server using the INSERT, UPDATE, DELETE, and MERGE statement. The SELECT, INSERT, UPDATE, DELETE, and MERGE...
View ArticleSQL INSERT Statement for SQL Server
Use the INSERT statement is to add rows to a SQL Server data table. In this article we explore how to use the INSERT statement. We discuss best practices, limitations, and wrap-up with several...
View ArticleUse SQL UPDATE to Query and Modify Data
The SQL UPDATE statement is used to change data within columns of a SQL Server data table. In this article we’ll explore how to use the UPDATE statement. We discuss some best practices, limitations,...
View ArticleIntroduction to the Delete Statement
The DELETE statement is used to remove rows from a SQL Server data table. In this article we’ll explore how to use the DELETE statement. We discuss some best practices, limitations, and wrap-up with...
View ArticleIntroduction to the Merge Statement
Introduction to the MERGE Statement and SQL Server Data Modification The MERGE statement is used to make changes in one table based on values matched from anther. It can be used to combine insert,...
View ArticleWhat is the Difference Between Merge and Update?
When modifying one table based on the contents of another it may be tempting to simply use the merge statement, but before you throw away all other forms of modifying data, I think it’s important for...
View ArticleRank Data with SQL
In this puzzle, we’re going to work through a problem to identify the top and bottom 25 percent to rank student scores. Solving puzzles is a great way to learn SQL. Nothing beats practicing what...
View ArticleSQL Puzzle: How to Calculate Moving Averages
In this puzzle, we’re going to learn how to calculate moving averages by working through a hypothetical stock market example. Solving puzzles is a great way to learn SQL. Nothing beats practicing what...
View ArticleReturn the first rows from your result.
In this video we’ll walk you though how to select top rows within a query. We’ll show you how to retrieve the top or bottom rows in the result. We’ll also show you how to use one sort to select the...
View ArticleHow to Find a Gap in a Sequence using SQL SERVER
In this puzzle, we’re going to learn how to find a gap in a sequence using SQL Server. I was recently reviewing my bank statement and noticed they flagged the start of a missing check number with...
View ArticleCommon Data Types used in SQL Server
In this video we’ll walk you though the common data types used in SQL Server; you’ll see examples of each type’s values, and how to define them. Once you’ve gone through this article, I would recommend...
View ArticleHow to Make a Join Easier to Read using Table Aliases
I recently put together a lesson on table aliases and multi-table joins. It is part of my Join Together Now course. Click here get the course at a discount. You’ll find that as you write more...
View ArticleWhat is a Non-Equi Join in SQL and What is its Purpose?
I recently put together a lesson on non-equi joins. It is part of my Join Together Now course. Click here get the course at a discount. A non-equi join can be used to solve some interesting query...
View ArticleHow do I handle a “Error converting data type” error?
A reader recently asked about a error converting data type error they received. Since this is a common issue, especially when numeric data is stored withing VARCHAR datatypes, I thought you would...
View ArticleDebugging Stored Procedures in SQL Server
I recently put together a lesson on debugging stored procedures. It is part of my Stored Procedures Unpacked course. When you debug stored procedures, you’re able to run their code line by line, to...
View ArticleWHILE Loops in T-SQL Stored Procedures
In this lesson, we’re going to learn about the While Loop. So, what is a While Loop? Well, While Loop is set up using a While statement. While statements are used to repeatedly execute a block of SQL...
View Article