Questions / Quant research, Data & feature research

A join silently multiplies rows

Foundation, about 6 minutes. Question R031.

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

  1. The join condition only checks symbol, so every trade matches both quotes.
  2. Each of three trades produces two output rows: 3 × 2 = 6.
  3. 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.

More data & feature research questions