Amazon recent BI SQL interview question
Anonymous User
1556

customer_id event_date status credit_limit
1 1/1/2019 C 1000
1 1/5/2019 F 1000
1 3/10/2019 1000
1 3/10/2019 1000
1 8/27/2019 L 1000
2 1/1/2019 L 2000
2 1/5/2019 2500
2 3/10/2019 2500
3 1/1/2019 S 5000
3 1/5/2019 6000
3 3/10/2019 B 5000
4 3/10/2019 B 10000

  1. Derive customer's account status as of month end for all the months in 2019. -- this is straightforward
    If for given month, there are more than one rows, pick the data from the latest date within the month. -- this is straightforward
    If for given month, there is no data, pick the data from latest date prior to the month -- this looks a bit tricky

Can any one please help in creating queries for these?

Comments (6)