
Order amount with tax
easyOrder 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 Name | Type |
|---|---|
| order_id | BIGINT |
| customer_id | BIGINT |
| order_date | DATE |
| status | VARCHAR |
| amount | DOUBLE |
ordersExample Input
| order_id | customer_id | order_date | status | amount |
|---|---|---|---|---|
| 1001 | 1 | 2024-01-05 | completed | 120.5 |
| 1002 | 2 | 2024-01-07 | completed | 2400 |
| 1003 | 1 | 2024-01-11 | completed | 89.99 |
| 1004 | 3 | 2024-01-15 | canceled | 45 |
| 1005 | 4 | 2024-01-18 | completed | 610.75 |
| 1006 | 2 | 2024-01-22 | completed | 1850.25 |
| 1007 | 5 | 2024-01-29 | completed | 3200 |
| 1008 | 1 | 2024-02-02 | refunded | 75 |
| 1009 | 6 | 2024-02-06 | completed | 55.4 |
| 1010 | 3 | 2024-02-09 | completed | 132.6 |
Example Output
| order_id | amount | amount_with_tax |
|---|---|---|
| 1001 | 120.5 | 142.19 |
| 1002 | 2400 | 2832 |
| 1003 | 89.99 | 106.19 |
| 1004 | 45 | 53.1 |
| 1005 | 610.75 | 720.69 |
| 1006 | 1850.25 | 2183.3 |
| 1007 | 3200 | 3776 |
| 1008 | 75 | 88.5 |
| 1009 | 55.4 | 65.37 |
| 1010 | 132.6 | 156.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.
Company
Stripe
Difficulty
easy
Topic
calculations
Your query
Starting the SQL engine...