Skip to main content
Java CodeexPractical programming, made clear
Courses
JavaSpring BootPythonAngularHibernateMySQLPostgreSQLDesign PatternsSpring AIInterviews
WorkshopsStart Learning
    • Java Tutorial Overview
    • Introduction to Java
    • Download and Install Java
    • Install IntelliJ IDEA
    • Java Methods
    • Java Arrays
    • Java Strings
    • Java OOP Concepts
    • Java Object Class
    • Java Interfaces
    • Java Exception Handling
    • Java Regular Expressions
    • Java Memory Management
    • Java Generics
    • Java Collections Framework
    • Java 8+ Features
    • Java Date and Time API
    • Java Multithreading
    • Java File Handling
    • Java Networking
    • Java JDBC
    • Java Marker Interfaces
    • Spring Boot Overview
    • Spring Boot Core Concepts
    • Spring Boot Setup and Installation
    • Spring Boot Project Structure
    • Spring Boot AOP
    • Spring Boot Data JPA
    • Spring Boot Hikari Connection Pool
    • Spring Boot Redis Cache
    • Spring Boot File Upload
    • Spring Boot Security
    • Spring Boot Global Exception Handling
    • Spring Boot Profiles
    • Spring Boot Scheduler
    • Spring Boot REST API
    • REST API Design Best Practices
    • Spring Boot Request Validation
    • Spring Boot Testing
    • Spring Boot Testing Comprehensive Guide
    • Spring Boot Actuator and Monitoring
    • Spring Boot Deployment
    • Spring Boot 2 to 3 Migration
  • Angular
  • Interviews
    • Python Tutorial
    • Python Tutorial
    • What is Python
    • Python Features
    • Advantages of Python
    • History of Python
    • Python Applications
    • Hello World Program in Python
    • How to Install Python?
    • Python Syntax
    • Python Keywords
    • Python Literals
    • Python Operators
    • Python Comments
    • Python Variables and Data Types
    • Python Variables
    • Python Data Types
    • Python Numbers
    • Type Casting in Python
    • Python Strings
    • Python String Methods
    • Python Booleans
    • Python Control Statements
    • Python if-else
    • Python Loops
    • Python For Loop
    • Python While Loop
    • Python Continue
    • Python Break Statement
    • Python Pass
    • Difference between Break and Continue in Python
    • Difference Between For Loop and While Loop in Python
    • Control Statements in Python
    • Hibernate Tutorial Overview
    • Hibernate Architecture
    • First Hibernate Example
    • Hibernate CRUD Example
    • Hibernate Generator Classes
    • Hibernate Dialects
    • Hibernate Collection Mapping
    • Hibernate List Mapping
    • Hibernate Bag Mapping
    • Hibernate One-to-Many Mapping
    • Hibernate Many-to-Many Mapping
    • Hibernate One-to-One Mapping
    • Hibernate Many-to-One Mapping
    • Hibernate Bidirectional Association
    • Hibernate Transaction Management
    • Hibernate First-Level Cache
    • Hibernate Second-Level Cache
    • MySQL SQL
    • MySQL SQL
    • MySQL SELECT
    • MySQL SELECT DISTINCT
    • MySQL WHERE
    • MySQL ORDER BY
    • MySQL AND
    • MySQL OR
    • MySQL NOT
    • MySQL INSERT INTO
    • MySQL NULL Values
    • MySQL UPDATE
    • MySQL DELETE
    • MySQL LIMIT
    • MySQL Aggregate Functions
    • MySQL MIN()
    • MySQL MAX()
    • MySQL COUNT()
    • MySQL SUM()
    • MySQL AVG()
    • MySQL LIKE
    • MySQL Wildcards
    • MySQL IN
    • MySQL BETWEEN
    • MySQL Aliases
    • MySQL Joins
    • MySQL INNER JOIN
    • MySQL LEFT JOIN
    • MySQL RIGHT JOIN
    • MySQL CROSS JOIN
    • MySQL Self Join
    • MySQL UNION
    • MySQL UNION ALL
    • MySQL GROUP BY
    • MySQL HAVING
    • MySQL EXISTS
    • MySQL ANY
    • MySQL ALL
    • MySQL INSERT SELECT
    • MySQL CASE
    • MySQL Null Functions
    • MySQL Stored Procedures
    • MySQL Comments
    • MySQL Operators
    • MySQL Database
    • MySQL Create DB
    • MySQL Drop DB
    • MySQL Create Table
    • MySQL Drop Table
    • MySQL Alter Table
    • MySQL Constraints
    • MySQL Not Null
    • MySQL Unique
    • MySQL Primary Key
    • MySQL Foreign Key
    • MySQL Check
    • MySQL Default
    • MySQL Create Index
    • MySQL Auto Increment
    • MySQL Dates
    • MySQL Views
    • MySQL Injection
    • MySQL Prepared Statements
    • PostgreSQL Introduction
    • PostgreSQL installation
    • PostgreSQL - pgAdmin4
    • PostgreSQL Create Table
    • PostgreSQL Insert Data
    • PostgreSQL Select Data
    • PostgreSQL ADD COLUMN
    • PostgreSQL UPDATE
    • PostgreSQL ALTER COLUMN
    • PostgreSQL DROP COLUMN
    • PostgreSQL DELETE
    • PostgreSQL DROP TABLE
    • PostgreSQL Operators
    • PostgreSQL SELECT
    • PostgreSQL SELECT DISTINCT
    • PostgreSQL WHERE
    • PostgreSQL ORDER BY
    • PostgreSQL LIMIT
    • PostgreSQL MIN and MAX
    • PostgreSQL COUNT
    • PostgreSQL SUM
    • PostgreSQL AVG
    • PostgreSQL LIKE
    • PostgreSQL IN
    • PostgreSQL BETWEEN
    • PostgreSQL AS
    • PostgreSQL Joins
    • PostgreSQL INNER JOIN
    • PostgreSQL LEFT JOIN
    • PostgreSQL RIGHT JOIN
    • PostgreSQL FULL JOIN
    • PostgreSQL CROSS JOIN
    • PostgreSQL UNION
    • PostgreSQL GROUP BY
    • PostgreSQL HAVING
    • PostgreSQL EXISTS
    • PostgreSQL ANY
    • PostgreSQL ALL
    • PostgreSQL CASE
  • Design Patterns
  • Spring AI
PostgreSQL tutorial
PostgreSQL IntroductionPostgreSQL installationPostgreSQL - pgAdmin4PostgreSQL Create TablePostgreSQL Insert DataPostgreSQL Select DataPostgreSQL ADD COLUMNPostgreSQL UPDATEPostgreSQL ALTER COLUMNPostgreSQL DROP COLUMNPostgreSQL DELETEPostgreSQL DROP TABLEPostgreSQL OperatorsPostgreSQL SELECTPostgreSQL SELECT DISTINCTPostgreSQL WHEREPostgreSQL ORDER BYPostgreSQL LIMITPostgreSQL MIN and MAXPostgreSQL COUNTPostgreSQL SUMPostgreSQL AVGPostgreSQL LIKEPostgreSQL INPostgreSQL BETWEENPostgreSQL ASPostgreSQL JoinsPostgreSQL INNER JOINPostgreSQL LEFT JOINPostgreSQL RIGHT JOINPostgreSQL FULL JOINPostgreSQL CROSS JOINPostgreSQL UNIONPostgreSQL GROUP BYPostgreSQL HAVINGPostgreSQL EXISTSPostgreSQL ANYPostgreSQL ALLPostgreSQL CASE

PostgreSQL

PostgreSQL HAVING

Filter groups after PostgreSQL calculates aggregates.

Use HAVING

SELECT year, COUNT(*) AS product_count
FROM products
GROUP BY year
HAVING COUNT(*) > 1;

Use WHERE to filter individual rows before grouping. Use HAVING to filter the grouped results.

Further Reading

Continue learning with these related tutorials:

  • PostgreSQL Introduction
  • PostgreSQL pgAdmin 4
  • PostgreSQL Create Table
  • PostgreSQL Insert Data
  • PostgreSQL Select Data
  • PostgreSQL ADD COLUMN
  • PostgreSQL UPDATE
  • PostgreSQL ALTER COLUMN
  • PostgreSQL DROP COLUMN
  • PostgreSQL DELETE
  • PostgreSQL DROP TABLE
  • PostgreSQL Operators
  • PostgreSQL SELECT
  • PostgreSQL SELECT DISTINCT
  • PostgreSQL WHERE
  • PostgreSQL ORDER BY
  • PostgreSQL LIMIT
  • PostgreSQL MIN and MAX
  • PostgreSQL COUNT
  • PostgreSQL SUM
  • PostgreSQL AVG
  • PostgreSQL LIKE
  • PostgreSQL IN
  • PostgreSQL BETWEEN
  • PostgreSQL AS
  • PostgreSQL Joins
  • PostgreSQL INNER JOIN
  • PostgreSQL LEFT JOIN
  • PostgreSQL RIGHT JOIN
  • PostgreSQL FULL JOIN
  • PostgreSQL CROSS JOIN
  • PostgreSQL UNION
  • PostgreSQL GROUP BY
  • PostgreSQL HAVING
  • PostgreSQL EXISTS
  • PostgreSQL ANY
  • PostgreSQL ALL
  • PostgreSQL CASE

Continue learning

PreviousPostgreSQL GROUP BYNext PostgreSQL EXISTS
Java Codeex

Learn programming, frameworks, and databases through clear explanations, practical examples, and real-world projects.

Courses

JavaPythonSpring BootAngularMySQLMongoDBPostgreSQL

Company

About UsAuthorCategoriesContact Us

Legal

Privacy PolicyTerms and ConditionsDisclaimer

Questions or suggestions?

contact@javacodeex.comjavacodeex.com
© 2026 Java CodeexLearn. Build. Grow.