Methy Interview Coding Question: SQL Schema for Customers, Subscriptions, Invoices, Payments, Usage, and Plans

15 Views
No Comments

Customers

customer_id
name
email
created_at

Subscriptions

subscription_id
customer_id
plan_id
start_date
end_date
status = ['active', 'canceled']

Invoices

invoice_id
subscription_id
amount
issued_date
due_date
status

Payments

payment_id
invoice_id
amount
payment_date

Usage

usage_id
subscription_id
usage_date
metric
value

Plans

plan_id
monthly_fee

This problem presents a subscription billing schema with six tables: Customers, Subscriptions, Invoices, Payments, Usage, and Plans. The key task is to understand the relationships between customer_id, subscription_id, invoice_id, and plan_id so you can connect user, billing, payment, and usage data correctly. It is a classic SQL interview-style data modeling question that typically involves JOINs, filtering by date or status, and aggregate queries such as counts, sums, and comparisons.

END
 0