← Deloitte Interview Insights

Deloitte·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Interviewed for a SWE role at Deloitte, mostly SQL fundamentals. Nothing too wild but the questions were more conceptual than I expected.

Questions Asked (1)

Q1

What are the key differences between the BETWEEN and HAVING clauses in SQL?

Data ModelingTechnical Trade-offs
Author's notes

I fumbled this a bit because I kept conflating HAVING with WHERE in my head.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly stating that BETWEEN and HAVING serve entirely different purposes: BETWEEN is a row-level filter for range conditions, while HAVING is a group-level filter applied after aggregation. Then explain each with a simple example, and highlight that they can even be used together in the same query.

Pro tip: Mention that BETWEEN is inclusive of endpoints, which can cause subtle bugs with date/time ranges—this shows attention to detail that interviewers at Deloitte appreciate. Also note that HAVING is often confused with WHERE, so clarifying that distinction reinforces your understanding.

1. Define BETWEEN

Explain that BETWEEN is a logical operator used in the WHERE clause to filter rows based on a range of values, and it is inclusive of the boundary values.

2. Define HAVING

Explain that HAVING is a clause used to filter groups after GROUP BY and aggregation, typically with aggregate functions like COUNT, SUM, AVG.

3. Contrast their roles

Emphasize that BETWEEN operates on individual rows before grouping, while HAVING operates on aggregated groups after grouping. They are not interchangeable.

4. Provide examples

Give a concrete SQL example for each: e.g., SELECT * FROM orders WHERE order_date BETWEEN '2023-01-01' AND '2023-12-31'; and SELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id HAVING COUNT(*) > 5;

5. Show combined usage

Demonstrate that both can appear in the same query: WHERE ... BETWEEN ... GROUP BY ... HAVING ... to reinforce that they serve different stages of query processing.

Key Points to Mention

  • BETWEEN is used for range filtering on rows, HAVING is used for filtering groups after aggregation.
  • BETWEEN is inclusive of endpoints; HAVING can use aggregate functions.
  • BETWEEN appears in WHERE clause; HAVING appears after GROUP BY.
  • HAVING can reference aggregate functions, WHERE cannot.
  • BETWEEN can be used with dates, numbers, or text; HAVING is typically used with numeric aggregates.
  • Both can be used together in a single query, but they operate at different stages of SQL execution.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.