Interview questions · Meta
Compute seller counts and vehicle share
This question evaluates data manipulation and analytical SQL competencies such as joining tables, aggregating and deduplicating interaction counts, applying date-window filters, and computing category-level percentage metrics.
You are given two tables:
-
listing_interactionsbuyer_idBIGINTseller_idBIGINTevent_dateDATEproduct_idBIGINTlisting_interactionsINT — number of buyer-seller interactions for that product on that date
-
dim_all_productsproduct_idBIGINTcategorySTRINGsnapshot_dateDATEcreate_dateDATEcountrySTRING
Assumptions:
- Join the tables on
product_id. - All dates are stored in UTC.
- Unless otherwise specified, use all available data.
- For Question 1, define a product as having multiple interactions if the total
listing_interactionssummed across all rows for the same(seller_id, product_id)is greater than 1. - For Question 2, define newly created listings in the US as products with
country = 'US'andcreate_datein the last 7 calendar days, inclusive ofCURRENT_DATE. - For Question 2, the numerator and denominator should both use
SUM(listing_interactions).
Write SQL for the following two tasks:
-
How many sellers have more than 3 distinct products that each have multiple interactions?
- Return one row with column:
seller_count
- Return one row with column:
-
Among newly created US listings from the last 7 days, what percentage of total listing interactions comes from the
vehiclecategory?- Return one row with column:
vehicle_interaction_pct - Express the result as a percentage from 0 to 100.
- Return one row with column:
Community answers
Nothing here yet.
Join in on CSWork →