What is a LATERAL join (CROSS APPLY / OUTER APPLY), and when would you use it for top-N-per-group queries?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Other
Overview: Asks what a LATERAL join (CROSS APPLY and OUTER APPLY in SQL Server) does and when to reach for it. Tests understanding of correlated subqueries in the FROM clause, top-N-per-group queries, inner versus outer semantics, and how the approach compares with window functions.