Back to questions

Card Launch Success JPMorgan Chase SQL Interview Question

Card Launch Success

JPMorgan Chase SQL Interview Question

Your team at JPMorgan Chase is soon launching a new credit card. You are asked to estimate how many cards you'll issue in the first month.

Before you can answer this question, you want to first get some perspective on how well new credit card launches typically do in their first month.

Write a query that outputs the name of the credit card, and how many cards were issued in its launch month. The launch month is the earliest record in the table for a given card. Order the results starting from the biggest issued amount.

Table:

Column NameType
issue_monthinteger
issue_yearinteger
card_namestring
issued_amountinteger

Example Input:

issue_monthissue_yearcard_nameissued_amount
12021Chase Sapphire Reserve170000
22021Chase Sapphire Reserve175000
32021Chase Sapphire Reserve180000
32021Chase Freedom Flex65000
42021Chase Freedom Flex70000

Example Output:

card_nameissued_amount
Chase Sapphire Reserve170000
Chase Freedom Flex65000

Explanation

Chase Sapphire Reserve card was launched on 1/2021 with an issued amount of 170,000 cards and the Chase Freedom Flex card was launched on 3/2021 with an issued amount of 65,000 cards.

The dataset you are querying against may have different input & output - this is just an example!

Hint: Try using a window function 👀

Input

(PostgreSQL)

Output