Societe Generale SQL Interview 2027: 2nd Highest Salary Query
Use `DENSE_RANK()`:
```sql SELECT salary FROM ( SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk FROM employees WHERE department = 'Engineering' ) t WHERE rnk = 2; ```
This returns the second-highest distinct salary in Engineering. This "Societe Generale 2nd highest salary sql" question is commonly reported by candidates.
Societe Generale 2Nd Highest Salary Sql: What This Question Assesses
The question tests window-function fluency and edge-case thinking. The naive `ORDER BY salary DESC LIMIT 1 OFFSET 1` breaks when the top salary appears twice — it would return the highest salary again instead of the second-highest distinct value. Interviewers want `DENSE_RANK()` because it shows you thought about duplicates.
Societe Generale 2Nd Highest Salary Sql: How to Answer
- Filter first. `WHERE department = 'Engineering'` — restrict to the requested department before ranking.
- Rank with DENSE_RANK(). `DENSE_RANK() OVER (ORDER BY salary DESC)` assigns the same rank to tied salaries with no gaps, so rank 2 is genuinely the second-highest distinct salary.
- Filter the rank. Wrap in a subquery and select `WHERE rnk = 2`.
- Discuss the alternatives. Mention why `LIMIT 1 OFFSET 1` fails on ties, and note `RANK()` would skip rank 2 if the top salary is tied — which is why `DENSE_RANK()` is the right choice.
Sample line: "I'd use DENSE_RANK ordered by salary descending inside a subquery and filter to rank 2 — that handles tied top salaries correctly, which LIMIT/OFFSET doesn't."
Common Mistakes
- Using LIMIT 1 OFFSET 1 — returns the top salary again when it is tied.
- Using RANK() instead of DENSE_RANK() — RANK() leaves gaps after ties, so rank 2 may not exist.
- Forgetting the department filter or applying it after ranking.
If window functions are not yet automatic for you, drill ranking problems before the interview — they are the most common SQL pattern in finance interviews. Details may vary by role and region; check Societe Generale's official careers page.
Keep Reading
- bcg teamwork interview question
- Societe Generale Phone Interview: What to Expect
- Societe Generale Sales Interview Questions & Answers
FAQ
How do you find the 2nd highest salary in SQL? Use DENSE_RANK() over salary descending in a subquery, then filter to rank 2 — this handles tied salaries correctly.
Why not use LIMIT 1 OFFSET 1? Because if the highest salary appears more than once, OFFSET 1 returns the highest salary again rather than the second-highest distinct value.
What is the difference between RANK() and DENSE_RANK()? RANK() leaves gaps after ties (1, 1, 3); DENSE_RANK() does not (1, 1, 2). For "nth highest distinct value," DENSE_RANK() is correct.
Is this a real Societe Generale interview question? SQL ranking questions are commonly reported by candidates in Societe Generale interviews, though exact questions may vary by role and region.
Preparing for Societe Generale's interview? Our 2027 Societe Generale Online Test & Video Interview Questions and Answers has practice questions and answers — $79 one-time, instant download.














































