Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Segment Expenses for Cost Savings

RipplingMediumSQL · PostgreSQL00:00
Rippling
Your interviewer · Financial Analyst
In session
Interviewer

Welcome to the SQL screen for the Financial Analyst role at Rippling.

The question is on your right: Segment Expenses for Cost Savings. Read through the requirements and the three tables first.

Would you like to talk through your approach, or are you ready to start coding?

Talking through your plan before coding is graded well.

Problem

You are given expense data across multiple business units and vendors. Write a PostgreSQL query that segments expenses by expense category and vendor, then returns the categories with the highest total spend and the share of spend coming from reimbursable expenses. Use the Rippling Expenses records to help surface cost-saving opportunities.

Schema

expenses
ColumnTypeDescription
expense_idPKINTPrimary key for each expense
employee_idINTEmployee who submitted the expense
vendor_idINTVendor used for the purchase
expense_dateDATEDate the expense was incurred
categoryVARCHAR(100)Expense category such as travel or software
amountDECIMAL(10,2)Expense amount
reimbursableBOOLEANWhether the expense is reimbursable
employees
ColumnTypeDescription
employee_idPKINTPrimary key for each employee
departmentVARCHAR(100)Employee department
locationVARCHAR(100)Employee location
vendors
ColumnTypeDescription
vendor_idPKINTPrimary key for each vendor
vendor_nameVARCHAR(255)Vendor name
vendor_typeVARCHAR(100)Vendor type such as airline or SaaS
Tablesexpensesemployeesvendors
Your solutionPostgreSQL
Run as often as you like, then submit when the output looks right.
Run a query to see results