Back to questions

User's Third Transaction Uber SQL Interview Question

User's Third Transaction

Uber SQL Interview Question

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

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

p.s. for more Uber SQL interview tips & problems, check out the Uber SQL Interview Guide

Input

(PostgreSQL)

Output