Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
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 feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
SQL for Business Scenarios
00:00
5 left

SQL for Business Scenarios

HardSQL · PostgreSQL

Problem

How would you write SQL queries for different business scenarios at TikTok Shop?

Using the supplied TikTok Shop tables, produce a monthly seller performance result for January and February 2025. Include completed orders only and treat sellers without qualifying orders as zero activity.

Output

  1. One row per seller and month, with seller_name, month, monthly_gmv, previous_month_gmv, month_over_month_change, monthly_rank, and cumulative_gmv.
  2. Include all sellers for both months, order by month, monthly_rank, and seller_name.

Schema

sellers
ColumnTypeDescription
seller_idPKINTUnique TikTok Shop seller identifier
seller_nameVARCHAR(100)Seller display name
regionVARCHAR(50)Seller operating region
products
ColumnTypeDescription
product_idPKINTUnique product identifier
seller_idINTSeller offering the product
product_nameVARCHAR(150)Product listing name
categoryVARCHAR(80)Product category
orders
ColumnTypeDescription
order_idPKINTUnique order identifier
order_dateDATEDate the order was placed
statusVARCHAR(30)Order lifecycle status
discount_codeVARCHAR(30)Optional promotional code
order_items
ColumnTypeDescription
order_item_idPKINTUnique order-line identifier
order_idINTParent order identifier
product_idINTPurchased product identifier
quantityINTUnits purchased
unit_priceNUMERIC(10,2)Price per unit at checkout
Tablessellersproductsordersorder_items
Interviewer

Your question is SQL for Business Scenarios. Start with the requirements and the four 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.