User Transaction Milestone
Uber ☯️ Medium SQL
Beginner Mode

Objective

Write a SQL query to find the third transaction for each user from the transactions table.

Table Schema:

  • transactions
Column Type Description
transaction_id INTEGER Unique identifier for each transaction
user_id INTEGER ID of the user who made the transaction
spend DECIMAL Amount spent in the transaction
transaction_date DATE Date when the transaction occurred
product_id INTEGER ID of the product purchased

Task Requirements:

  • Identify the third transaction for each user based on transaction_date
  • Return only users who have at least 3 transactions
  • Display user_id, spend, and transaction_date for the third transaction

Output columns: user_id, spend, transaction_date

Examples

Example 1:

Input:

transactions
product_idspendtransaction_datetransaction_iduser_id
50125.52024-01-101101
502422024-01-152101
50318.752024-01-203101
504332024-01-124102
50555.252024-01-185102

Output:
spendtransaction_dateuser_id
18.752024-01-20101
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 →