de_notes

📚 HAVING CLAUSE

The HAVING clause is used in SQL to filter groups of rows after aggregation.
It works like WHERE, but it operates on grouped data after GROUP BY.


🛠️ Basic Syntax

SELECT column1, aggregate_function(column2)
FROM table_name
GROUP BY column1
HAVING condition;

Example

SELECT department, COUNT(*)
FROM employees
GROUP BY department
HAVING COUNT(*) > 5;

Key Points

Additional Example

SELECT city, AVG(salary)
FROM employees
GROUP BY city
HAVING AVG(salary) > 70000;

🎥 Video Notes


📝 Problem Description

Describe the problem, challenge, or topic discussed in a video related to SELECT FROM.
What concept was explained or what exercise was solved?


DataBase Given


💻 My SQL Code

-- Write your SQL code attempt or solution related to SQL COMMAND
SQL COMMAND

🧠 Solution Code / Explanation

SQL COMMAND

Explanation - Explain what you learned, any key takeaways, or how you solved the problem related to COMMAND._


⬅️ Previous: AVG OPERATOR Next ➡️ SUBQUERY WITH AGGREGATE FUNCTIONS