This advanced SQL exercise is part of the book: Advanced SQL – Practical Techniques and Use-Cases, which includes 100 day-to-day SQL challenges (and solutions), need-to-know advanced features, and key concepts.

An interesting SQL exercise. Given a table that represents date ranges:

(str_date date, end_date date)

Carefully studying the table reveals that:

  • The range of days between the earliest date (02.02.2016) and the most recent date (16.02.2016) is 15 (15 days, because 02.02.2016 is included in the range).
  • Out of these 15 days, 4 dates do not appear in the table: 11.02.2016, 12.02.2016, 13.02.2016, 15.02.2016.

Would you like to read more?