Reviewed by Aditya Kumar · Last reviewed 2026-03-24
Given |A|=a, |B|=b, |matches|=m: **Inner** = m. **Left** = a. **Right** = b. **Full outer** = a + b - m. **SQL**: SELECT 'inner', COUNT(*) FROM a INNER JOIN b ON ... UNION ALL SELECT 'left', COUNT(*) FROM a LEFT JOIN b ON ......
Given |A|=a, |B|=b, |matches|=m: Inner = m. Left = a. Right = b. Full outer = a + b - m. SQL: SELECT 'inner', COUNT() FROM a INNER JOIN b ON ... UNION ALL SELECT 'left', COUNT() FROM a LEFT JOIN b ON ... Validate: Full = Left + Right - Inner when no duplicates.
Red Flag: Wrong join key = wrong counts. Pro-Move: 'We built a join validation job that compares actual counts to expected (from metadata)—catches key mismatches in pipeline.'
According to DataEngPrep.tech, this is one of the most frequently asked SQL interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.