Questions / Quant research, Data & feature research
A join silently multiplies rows
For one symbol, a trades table has 3 rows and a quotes table has 2 rows. An inner join uses only symbol and every row shares it. How many output rows are produced?
Answer it in the app It's free. You get hints, a second try if you miss, and a follow-up question.
Show the answer and worked solution
Answer: 6 rows
- The join condition only checks symbol, so every trade matches both quotes.
- Each of three trades produces two output rows: 3 × 2 = 6.
- There is no timestamp restriction or latest-quote selection to reduce the matches.
Interview shortcut. A join on a shared key multiplies: 3 × 2.
Takeaway. Check matches per input row before interpreting joined aggregates.
In the app this has a follow-up where one thing about the setup changes. Try the follow-up.