The goal of this question is to design a SQL table and query to track and retrieve the correct Netflix billing tier for each customer.
NetflixCustomers exists, which contains the current active subscription tier of all clients.CREATE TABLE NetflixCustomers (
CustomerID INT PRIMARY KEY,
Name VARCHAR(100),
SubscriptionTier VARCHAR(20)
);Basic, Standard, Premium| CustomerID | Tier |
|---|---|
| 1001 | Basic |
| 1002 | Standard |
| 1003 | Premium |
| 1004 | Basic |
| 1005 | Premium |
Scenario: A customer has only the Basic tier active for the entire month.
Expectation: The billing should be for the Basic tier, as no changes occurred.
Scenario: A customer starts with Basic, upgrades to Standard on the 10th of the month, then to Premium on the 20th of the same month.
Expectation: The billing should be for the Premium tier because it’s the highest tier reached within the month.
Scenario: A customer starts with Premium, downgrades to Standard on the 15th of the month, and finally to Basic on the 25th.
Expectation: The billing should still be for the Premium tier, as that was the highest tier reached in the month.
Scenario: A customer starts with Basic, upgrades to Premium on the 5th, downgrades to Standard on the 15th, and then downgrades to Basic on the 25th.
Expectation: Billing should be for Premium, since it’s the highest tier reached during the month.
Scenario: A customer was on the Standard tier in the previous month and made no changes this month.
Expectation: The billing should remain at the Standard tier for the current month.
Scenario: A customer is on Basic for the entire month and upgrades to Premium on the last day of the month.
Expectation: Billing should be for the Premium tier, as that’s the highest tier reached in the month.
Scenario: A customer starts on Premium but downgrades to Standard on the 1st of the month.
Expectation: Billing should still be for Premium, since it was the active tier at the start of the month.
Scenario: A customer starts on Basic, upgrades to Standard on the 15th, and makes no changes in the next month.
Expectation: Billing for the current month should be Standard, and for the next month, it should remain Standard unless another change is made.
Scenario: A new customer joins on the 15th and starts with a Standard tier.
Expectation: Billing should be for Standard, as there were no other changes during the month.
Scenario: A customer has no active tier for the entire month due to a subscription pause or cancellation.
Expectation: The billing should reflect that there’s no active tier, or show "None."
Scenario: A customer upgrades to Premium in the morning and downgrades back to Basic in the evening of the same day.
Expectation: Billing should still be for Premium, as it was the highest tier reached during the month.
Note: This is a self-exercise question and is not sourced from any interview