logo

Back to questions

User's Third Transaction

Medium

This is the same question as problem #11 in the SQL Chapter of Ace the Data Science Interview!

Assume you are given the table below on Uber transactions made by users. Write a query to obtain the third transaction of every user. Output the user id, spend and transaction date.

Table:

Column NameType
user_idinteger
spenddecimal
transaction_datetimestamp

Example Input:

user_idspendtransaction_date
111100.5001/08/2022 12:00:00
11155.0001/10/2022 12:00:00
12136.0001/18/2022 12:00:00
14524.9901/26/2022 12:00:00
11189.6002/05/2022 12:00:00

Example Output:

user_idspendtransaction_date
11189.6002/05/2022 12:00:00

PostgreSQL 14

Refer friends to get bonus content & cool prizes.