mahir_data
hardGXBank · windowBasicNew

Show each customer's previous tier alongside their new one

The plan_changes table logs every tier change per customer, in order. For each row, return customer, changed_at, new_tier, and previous_tier — the tier the customer was on immediately before this change.

A customer's very first logged change should show previous_tier as NULL.

Schema

plan_changes
idINT
customerTEXT
changed_atDATE
new_tierTEXT

Basic

The example input, expected output, and walkthrough for this question unlock with a Basic plan.

Basic

This is a Basic question

Premium practice questions unlock with a Basic plan. The full solution, expected output, and grading are available to Basic members.

See Basic plans