KatInterview

Power Sellers and Vehicle Share of New US Listing Engagement

SQL & DataModel answer
MediumModel answerSQL & Datasqljoinsaggregation

Last updated

Two SQL tasks on a marketplace: count sellers with many well-engaged products in a short window, and compute the Vehicle share of interactions on newly created US listings.

Marketplace engagement queries

You work with two tables from a classifieds marketplace.

listing_interaction: one row per buyer, seller, product and day.

columnmeaning
buyer_idthe buyer involved
seller_idthe seller who owns the listing
dateday of the interaction
product_idthe listing interacted with
linumber of listing interactions that day

dim_all_product: a daily snapshot of product attributes, so a product can appear once per date.

columnmeaning
product_idthe listing
categorye.g. Vehicle, Home, Housing
datesnapshot day
create_dateday the listing was created
countrye.g. US, CA, UK

Part A

Over the last 3 calendar days, how many distinct sellers have more than three products where each of those products has li > 1?

Part B

Considering only listings created in the US within the last 7 days, what percentage of total li comes from the Vehicle category?

What to deliver

  • A SQL query (or equivalent pandas code) for each part.
  • The assumptions you made about ambiguous wording, such as whether "last N days" includes today, and at what level li > 1 is evaluated.
  • The edge cases you considered and how you would check that the results are correct.