89

Consecutive Order Days

HardMINMAXdate functions

Problem Description

Write a SQL query to find the date range (first and last order date) for each customer.

Expected Columns

  • customer_name
  • first_order
  • last_order
  • days_as_customer

Example Output

| customer_name | first_order | last_order | days_as_customer | |---------------|-------------|------------|------------------| | Rajesh Kumar | 2023-01-20 | 2023-04-20 | 90 | | Sunita Devi | 2023-01-25 | 2023-03-10 | 44 | | ... | ... | ... | ... |

Hints

Unlocks after 2 more attempts
Submit your solution to unlock hints

Related Topics

MINMAXdate functionsJULIANDAY
//#89 Consecutive Order Days
Hard

Loading schema...

Loading editor...

No results yet

Run a query to see results