Use INNER JOIN for required matches, LEFT JOIN when preserving unmatched left rows (putting right-table filters in ON rather than WHERE), CTEs for readability, and window functions (ROW_NUMBER, RANK, LAG, SUM OVER) when computing per-row metrics without collapsing rows via GROUP BY.
Follow-up Interview Question · When can a CTE block or change query optimization compared to an inline subquery?