Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Conversion rates
Time to first order
Conversion charts
13. Filtering with intervals
Summary

Instruction

Very well done! Let's leave dates for a while, and use some intervals to filter our data. Take a look at this query:

SELECT
  full_name,
  country,
  last_order_date
FROM customers
WHERE first_order_date - registration_date <= INTERVAL '7' day

For those who placed their first order within one week from registration, this query gets their names, countries, and when their last orders were placed.

Exercise

Let's practice filtering with intervals a bit. Find all customers who placed their first order within one month from registration, and their last order within three months from registration – let's see who's stopped ordering. For each customer show these columns: email, full_name, first_order_date, last_order_date.

Stuck? Here's a hint!