Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

WHERE vs HAVING in Operations

EasySQL & Data Manipulation00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to your interview.

The question is on your right: WHERE vs HAVING in Operations. Take a moment with it first.

Talk your thinking through with me if you like - when you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes). Discussion and graded submissions share your five interviewer interactions, so spend them well.

You need to log in / sign up to chat or submit.

Problem

Context

At companies like FleetOps, operational dashboards often need both row-level filtering and group-level filtering. Interviewers ask this to confirm that you understand when filtering happens in SQL execution.

Core question

Explain the difference between WHERE and HAVING in SQL. In your answer, cover:

  1. What each clause filters
  2. When each clause is evaluated in a query
  3. Why WHERE cannot usually filter aggregate results directly
  4. A simple example showing both clauses used correctly in the same query

Scope guidance

Keep the explanation practical. The interviewer is usually looking for a clear distinction between row-level filtering and post-aggregation filtering, plus one or two examples of common mistakes such as using HAVING when WHERE is more appropriate.