Your question is SQL Top 5% by Tier. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Navy Federal Credit Union wants to identify the highest-volume members within each card tier. Write a PostgreSQL query that aggregates completed card transactions and uses window functions to return the top 5% of members in every tier.
card_tier by volume descending, using member_id as a deterministic tie-breaker.| Column | Type | Description |
|---|---|---|
| member_idPK | INT | Navy Federal member identifier |
| member_name | VARCHAR(100) | Member's full name |
| card_tier | VARCHAR(20) | Member's Navy Federal card tier |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique card transaction identifier |
| member_id | INT | References members.member_id |
| transaction_amount | DECIMAL(12,2) | Amount of the card transaction |
| transaction_status | VARCHAR(20) | Transaction status, such as COMPLETED or PENDING |