Enqurious logo
Liked the scenario! Give it a shot for free
Get access

Look at the table : order_payments

 

Here's what the columns mean : 

  • order_id - Refers to an order (same ID which exists in orders table)
  • payment_sequential - Ignore this
  • payment_type - What mode was used for payment? (Debit Card, Credit Card or Voucher)
  • payment_installments - In how many installments (EMIs) was the payment made for the given order? Or how many months were taken by customer to complete the EMI payment
  • payment_value - Ignore this

GlobalMart has offered EMI flexibility to customers to enable them make bigger purchases without constraining their pockets. However, they also don't want to stretch the EMIs for a long time. Hence, they've made a rule to label orders based on how many months they took to complete the EMI payments. 

The logic goes as below :

  • Short_term : If payment was completed within 6 months (inclusive)
  • Mid_term : If payment was completed between 6 to 12 months
  • Long_term : If payment took more than 12 months of EMI to complete

Based on this, GlobalMart would like to understand the distribution of short_term, mid_term and long_term EMI payments among customer segments. 

 

Can you fetch the below output and help GlobalMart team answer some quick questions?

 

(numbers are only for representation purposes)

 

Tables to be referred : 

  • Customers
  • Orders
  • Order Payments
In Corporate segment ________ orders were paid off in short_term payments
277
155
401
264
Under Consumer ________ payments were the highest
Short Term
Mid Term
Long Term
__________ didn't have any long term payments
Home Office
Consumer
Corporate
Copy paste your SQL to solve this scenario