Order amount with tax

calculations

Order amount with tax

Stripe SQL Interview Question

An online store uses Stripe Tax to add 18% tax to its orders, and Stripe needs to show the full amount each customer pays on the invoice.

List the order_id, the original amount, and the amount including 18% tax as amount_with_tax, rounded to 2 decimal places.

Asked of

  • Data Analyst
  • Business Analyst
  • BI Analyst
  • Product Analyst

ordersTable35 rows

Column NameType
order_idBIGINT
customer_idBIGINT
order_dateDATE
statusVARCHAR
amountDOUBLE

ordersExample Input

order_idcustomer_idorder_datestatusamount
100112024-01-05completed120.5
100222024-01-07completed2400
100312024-01-11completed89.99
100432024-01-15canceled45
100542024-01-18completed610.75
100622024-01-22completed1850.25
100752024-01-29completed3200
100812024-02-02refunded75
100962024-02-06completed55.4
101032024-02-09completed132.6

Example Output

order_idamountamount_with_tax
1001120.5142.19
100224002832
100389.99106.19
10044553.1
1005610.75720.69
10061850.252183.3
100732003776
10087588.5
100955.465.37
1010132.6156.47

Explanation

Order 1001 is 120.50 before tax. Adding 18% tax brings it to 142.19 once rounded to 2 decimal places. Order 1002 is 2,400 before tax and 2,832 after tax.

The example above is a small slice of the data. Your query runs against the full tables.