If you have multiple CTE’s in a query then you can do what’s called a nested CTE. This is what Steve will go over in this video. Transcription of Video: So next, if you’ve got multiple CTE’s, we can do what are considered nested CTE’s, where the previous multiples we looked at, it was just two CTE’s that were being …

Nested CTE’s in SQL Server Read more »

Let’s start slow with a simple CTE query demo for easy absorption. Transcription of video: So let’s take a look at how to write a simple CTE query. So what I have is a test database here that I’ve set up called CTE demo. And in that I’ve got a couple tables one’s called royalty that has a bunch of …

How to Write a Simple CTE Query Read more »

Check out this video explanation of how to put multiple CTE’s in a single query. Check back tomorrow for the demo on this. Transcription to this video: Now that we’ve covered how to build a CTE and how to replace some derived tables or sub queries with CTE’s, now we’re going to look at how do we put multiple common …

Multiple CTE’s in a Single Query – Explanation Read more »

As a continuation from the day before, here is the multiple CTE’s in a query demo. Transcription of the demo: All right. So here’s an example of a simple CTE that just does a union to return a list that says John, Mary, and Bill. And then we have a second one, that’s last names that just returns, Smith give …

Multiple CTE’s in a Query – Demo Read more »

What is with, WITH? If you don’t know watch Steve’s quick 2 minute video explanation. Transcription of video: Okay, so the syntax of using common table expressions is to use the WITH keyword. all CTE start with the word WITH rather than select like you would normally have in your queries. And it can be confusing if you’re assuming that …

CTE Syntax using WITH Read more »

Steve quickly touches on which versions of SQL Server common table expressions are available on. Transcription of Video: So common table expressions have been available since SQL Server 2005. And I really wish that I’d learned about common table expressions when they first came out. I think it was around 2010 2011 that I first learned about them. And I …

The Availability of Common Table Expressions Read more »

Over 250 pages of Common Table Expression lessons! Download your FREE copy today! The Common Table Expression (CTE) is one of the more powerful and often overlooked features in Microsoft SQL Server. This book will show some of the more interesting things you can do with a CTE. You will learn how CTEs are a great alternative to derived table …

Improve you query skills Steve’s CTE book! Read more »

In this short but to the point video Steve explains the question “what is a CTE?” Transcription of this video: CTE is kind of this concept of what we’re calling a virtual table where it’s like a sub query or like a view where it’s referencing another chunk of SQL query that’s going to be used and named. Similar to …

What is a CTE? – Video Explanation Read more »

Common table expressions are beneficial to use when writing or managing complex queries. Being condensed or simplified, CTEs increase accessibility and digestion. Watch Steve’s video for more on CTEs…… Transcription of this video: Why would you use common table expressions? I mean, you may have been writing SQL queries for 10 or more years, and have never used a common …

Why Use Common Table Expressions Read more »

Hooray! It’s CTE month. Some of you may be happy but you others may by like ugh. Common table expressions can be tough and confusing but WE’VE GOT YOU COVERED! This month we will be throwing lots of valuable CTE information and resources at you including….. Instructional videos Tips of the trade And a FREE download! Check in daily to …

It’s CTE Month at Stedman Solutions Read more »