Monthly Card Issuance Variance
JPMorgan 👶 Easy SQL
Beginner Mode

Objective

Write a SQL query to calculate the variance in monthly card issuance for each credit card.

Table Schema:

  • card_issuance
Column Type Description
issue_id INTEGER Unique identifier for each issuance record
card_name VARCHAR Name of the credit card
issued_amount INTEGER Number of cards issued
issue_month DATE Month of issuance
issue_year INTEGER Year of issuance

Task Requirements:

  • Find the maximum issued amount for each card across all months
  • Find the minimum issued amount for each card across all months
  • Calculate the difference (max - min) for each card
  • Sort results by the difference in descending order

Output columns: card_name, issued_difference

Examples

Example 1:

Input:

card_issuance
card_nameissue_idissue_monthissue_yearissued_amount
Chase Sapphire12023-01-0120235000
Chase Sapphire22023-02-0120238000
AmEx Gold32023-01-0120233000
AmEx Gold42023-02-0120233500

Output:
card_nameissued_difference
Chase Sapphire3000
AmEx Gold500
Quick Solution

Code Environment

Sign in or try as guest to run your code.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →