SQL and Python
Interview question
- midlevel
- 8 minsuggested time
- 3Data analyst, Data scientist, ML engineer
Two queries in a code review. (1) A report meant to list every flight-day with its web promotion, if any, uses
flight_day f LEFT JOIN promotions p ON ... WHERE p.channel = 'web', and flights without promotions are missing.
(2) A query for flights that never had a promotion uses WHERE f.flight_no NOT IN (SELECT flight_no FROM promotions) and returns zero rows, although such flights exist. Explain both bugs and fix them.
Sign in to practise: answers are saved before model answers are shown.