Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Profit Increase From FX Conversion
00:00
5 left

Profit Increase From FX Conversion

MediumSQL · PostgreSQL

Problem

Business Context

DRW's quantitative analytics team compares Company A's quarterly profitability in EUR, although source profit records are stored in USD. Exchange rates vary by date, so each profit record must be converted before aggregation.

Task

Write a PostgreSQL query that calculates the percentage increase in Company A's EUR-denominated profit from the first to the last month of Q1 2025.

Requirements

  1. Join companies, profit records, and daily FX rates.
  2. Convert each USD profit using profit_usd * eur_per_usd, then aggregate by month.
  3. Ignore records with missing profit or FX values and exclude dates outside Q1 2025.
  4. Return the first month, last month, EUR profit for each, and the percentage increase rounded to two decimals.

Schema

companies
ColumnTypeDescription
company_idPKINTUnique company identifier
company_nameVARCHAR(100)Company name
profit_records
ColumnTypeDescription
profit_idPKINTUnique profit record identifier
company_idINTReferences companies.company_id
profit_dateDATEDate of the profit record
profit_usdNUMERIC(18,2)Profit amount in USD
fx_rates
ColumnTypeDescription
rate_datePKDATEDate for the USD to EUR rate
eur_per_usdNUMERIC(10,6)EUR value of one USD
Tablescompaniesprofit_recordsfx_rates
Interviewer

Your question is Profit Increase From FX Conversion. Start with the requirements and the three tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.