You are on page 1of 2

Instructions

1. We expect you to submit all the answers in presentation format (Ms. PowerPoint or
Google Slides), in English.
2. You will get two separate .sql files. Each file contains table structure and dummy data.
3. You can set up your own PostgreSQL database or you can use https://www.db-
fiddle.com/ with PostgreSQL v12 as the database.
4. You have max a week to submit your answers.

Case
For this case you will play with two tables
1. ovo_transaction: a transaction table, each row represents user payment using OVO.
Columns are:
a. txndate : transaction date,
b. merchant_id : merchant identifier where customer transacted with,
c. merchant_name : merchant name where customer transacted with,
d. ovo_id : ovo customer unique identifier
e. txn_id : transaction unique identifier,
f. store_code : merchant’s store identifier,
g. payment_type : type of payment, ovo cash or ovo points,
h. amount : total amount of transaction,
i. cashback : total cashback amount customer got in transaction
2. ovo_ref_merchant: contains merchant details. Columns are:
a. merchant_name : merchant name,
b. merchant_id : merchant unique identifier,
c. store_code : merchant’s store code
d. city : the city where the store is located

Section 1.1
Using the provided data, please share with us the insights you can find. Is there any issue you
want to highlight? Do you have any suggestions for the management? Please share your findings
and suggestions in a way you are presenting to the OVO senior management team.
Section 1.2
Using the provided data, for each question you need to generate 1 single SQL statement. Please
construct the queries as efficiently as possible, along with proper comments why you think it is
the most efficient way.
1. List total unique customers that had transactions in JABODETABEK between 4 August
2020 and 17 August 2020.
2. List only the Top 10 cities who had the highest transaction amount, per month.
3. List total unique customers, total number of transactions, total amount paid, and total
cashback per merchant, sort it by total number of transactions from biggest to smallest,
then remove merchants who have cash back ratio (total cashback / total amount) below
5%.
4. Show the distribution of customers based on the number of unique merchants s/he had
transacted with. (Distribution of customer that have done transaction in 1 unique
merchant, 2 unique merchants, 3 unique merchants, etc)
5. List customers who have transactions in the exact following order of merchants: TOKO
BAJU, KOPI NONGKRONG, then KAKI LIMA. (If customer have transactions in the same
merchant multiple times in sequential order then it counts as one appearance, for
example: TOKO BAJU, KOPI NONGKRONG, KOPI NONGKRONG, KAKI LIMA, KOPI
NONGKRONG will be TOKO_BAJU, KOPI NONGKRONG, KAKI LIMA, KOPI
NONGKRONG. hints: you can use transaction id to sort transactions)

You might also like