← Bitkernel Interview Insights

Bitkernel·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Did a technical screen for a Software Engineer role at Bitkernel and they hit me with a SQL evaluation order question. Pretty niche for a phone screen but I guess they wanted to see if you actually understand what the database is doing under the hood versus just writing queries that happen to work.

Questions Asked (1)

Q1

In a standard SQL query that includes FROM, WHERE, GROUP BY, HAVING, SELECT, and ORDER BY clauses, what is the logical order in which the database engine processes those clauses?

Technical Trade-offsData Modeling
Author's notes

I knew SELECT wasn't first but I second-guessed myself on where HAVING falls relative to GROUP BY.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by stating the logical processing order clearly: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY. Then briefly explain why this order matters, especially how it affects column aliases and aggregate functions.

Pro tip: Mention that while logical order is fixed, the physical execution may differ due to query optimization, but understanding logical order is crucial for writing correct SQL and debugging errors.

1. State the logical order

List the clauses in the order the database engine logically processes them: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY.

2. Explain the role of each clause

Briefly describe what each clause does in the processing pipeline, e.g., FROM assembles data, WHERE filters rows, GROUP BY aggregates, HAVING filters groups, SELECT computes expressions, ORDER BY sorts.

3. Highlight implications

Discuss why this order matters: e.g., you cannot use SELECT aliases in WHERE, but you can in ORDER BY; HAVING operates on aggregated results, not individual rows.

4. Connect to practical scenarios

Give an example or two showing how misunderstanding the order leads to errors, such as trying to filter on an aggregate in WHERE instead of HAVING.

Key Points to Mention

  • Logical order vs. physical execution order
  • WHERE filters rows before grouping; HAVING filters after grouping
  • SELECT is evaluated after GROUP BY and HAVING, so aliases are not available in WHERE
  • ORDER BY is the last step, so it can use SELECT aliases
  • Aggregate functions are computed during GROUP BY and can be filtered in HAVING
  • Understanding this order helps write correct and efficient SQL queries

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