PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/PayPal

Compare WHERE vs HAVING with aggregates

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of SQL aggregation and group-level filtering, specifically the roles of WHERE and HAVING when filtering aggregates and how query execution order affects which clauses can reference aggregate expressions.

  • Medium
  • PayPal
  • Data Manipulation (SQL/Python)
  • Data Scientist

Compare WHERE vs HAVING with aggregates

Company: PayPal

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

Filter groups based on an aggregate and explain WHERE vs HAVING. Provide a query that returns merchants with chargeback_rate > 0.5% in the last 30 days using HAVING. Clarify why WHERE cannot reference aggregates, how HAVING works after GROUP BY, dialect differences (e.g., MySQL allowing expressions in HAVING without GROUP BY), and performance considerations.

Quick Answer: This question evaluates a candidate's understanding of SQL aggregation and group-level filtering, specifically the roles of WHERE and HAVING when filtering aggregates and how query execution order affects which clauses can reference aggregate expressions.

Related Interview Questions

  • Write SQL using HAVING and window functions - PayPal (easy)
  • Write SQL for top drivers and cancellation rates - PayPal (easy)
  • Compute top orders and cancellation rate - PayPal (easy)
  • Write SQL to flag Venmo ATO - PayPal (Medium)
  • Write conditional aggregation SQL queries - PayPal (Medium)
PayPal logo
PayPal
Jul 31, 2025, 12:00 AM
Data Scientist
Onsite
Data Manipulation (SQL/Python)
1
0

Filter groups based on an aggregate and explain WHERE vs HAVING. Provide a query that returns merchants with chargeback_rate > 0.5% in the last 30 days using HAVING. Clarify why WHERE cannot reference aggregates, how HAVING works after GROUP BY, dialect differences (e.g., MySQL allowing expressions in HAVING without GROUP BY), and performance considerations.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More PayPal•More Data Scientist•PayPal Data Scientist•PayPal Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.