Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Generating Date Ranges | Recursive CTEs and Hierarchical Data
Mastering Common Table Expressions (CTEs) in SQL
Section 2. Chapter 6
single

single

Challenge: Generating Date Ranges

Swipe to show menu

Task

Swipe to start coding

Create a recursive CTE that generates all dates between two given dates, inclusive.

  • Start with a base case that selects the initial date as report_date.
  • Recursively add one day to the previous report_date until the end date is reached.
  • The output must include every date from the start date to the end date, inclusive.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 6
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt