Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Monthly Trader Insight Summary

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Monthly Trader Insight Summary. Start with the requirements and the three tables on the right.

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.

Problem

You are given trading activity data from a platform such as Wolverine Trading's internal analytics environment. Write a PostgreSQL query that returns one row per trader for February 2024, showing each trader's name, team, number of executed orders, total filled quantity, gross trading revenue, and an activity label of High Activity, Moderate Activity, or Low Activity based on executed order count. Include traders even if they had no executed orders in February.

Use only February 2024 orders, count only rows where status = 'EXECUTED', and classify traders as High Activity for 3+ executed orders, Moderate Activity for 1-2, and Low Activity for 0.

Schema

traders
ColumnTypeDescription
trader_idPKINTPrimary key for each trader
trader_nameVARCHAR(100)Trader full name
team_idINTReference to the trader's team
start_dateDATEDate the trader joined
teams
ColumnTypeDescription
team_idPKINTPrimary key for each team
team_nameVARCHAR(100)Team name
orders
ColumnTypeDescription
order_idPKINTPrimary key for each order
trader_idINTReference to the trader who placed the order
symbolVARCHAR(20)Traded symbol
order_dateDATEOrder date
statusVARCHAR(20)Order status such as EXECUTED or CANCELLED
filled_qtyINTFilled quantity for the order
gross_revenueDECIMAL(12,2)Gross revenue generated by the order
Tablestradersteamsorders
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results