---
title: "What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?"  
description: "What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?"  
author: "Sumit Kesarwani"  
published: 2013-12-29  
updated: 2020-09-18  
canonical: https://www.mindstick.com/interview/1871/what-is-the-difference-between-a-having-clause-and-a-where-clause  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?

HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query whereas WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.

## Answers

### Answer by Sumit Kesarwani

HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query whereas WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.


---

Original Source: https://www.mindstick.com/interview/1871/what-is-the-difference-between-a-having-clause-and-a-where-clause

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
