{"id":768,"date":"2017-09-09T11:12:20","date_gmt":"2017-09-09T04:12:20","guid":{"rendered":"https:\/\/oracletutorial.com\/?page_id=768"},"modified":"2025-05-04T05:22:42","modified_gmt":"2025-05-04T12:22:42","slug":"oracle-having","status":"publish","type":"page","link":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/","title":{"rendered":"Oracle HAVING Clause"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: In this tutorial, you&#8217;ll learn how to use the Oracle <code>HAVING<\/code> clause to filter groups returned by the <code>GROUP BY<\/code> clause.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-oracle-having-clause'>Introduction to the Oracle HAVING clause <a href=\"#introduction-to-the-oracle-having-clause\" class=\"anchor\" id=\"introduction-to-the-oracle-having-clause\" title=\"Anchor for Introduction to the Oracle HAVING clause\">#<\/a><\/h2>\n\n\n\n<p>The <code>HAVING<\/code> clause is an optional clause of the <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-select\/\">SELECT<\/a><\/code> statement. The <code>HAVING<\/code> clause allows you to filter groups created by the <a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-group-by\/\"><code>GROUP BY<\/code><\/a> clause.<\/p>\n\n\n\n<p>Here&#8217;s the basic syntax of the <code>HAVING<\/code> clause:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span>\n  select_list\n<span class=\"hljs-keyword\">FROM<\/span>\n  table_name\n<span class=\"hljs-keyword\">GROUP<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  c1, c2, c3\n<span class=\"hljs-keyword\">HAVING<\/span>\n  filter_condition;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, the <code>GROUP BY<\/code> clause groups rows into groups.<\/li>\n\n\n\n<li>Second, the <code>HAVING<\/code> clause keeps only groups that satisfy the <code>filter_condition<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>Note that the <code>HAVING<\/code> clause <strong>filters groups of rows,<\/strong> whereas the <code>WHERE<\/code> clause filters rows. This is the main difference between the <code>HAVING<\/code> and <code>WHERE<\/code> clauses.<\/p>\n\n\n\n<p>When executing a&nbsp;<code>SELECT<\/code>&nbsp;statement, Oracle evaluates the&nbsp;<code>HAVING<\/code>&nbsp;clause after the&nbsp;<code>GROUP BY<\/code> clause and before the&nbsp;<code>SELECT<\/code>&nbsp;clause in the following sequence:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>FROM<\/li>\n\n\n\n<li><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-where\/\">WHERE<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-group-by\/\">GROUP BY<\/a><\/li>\n\n\n\n<li>HAVING<\/li>\n\n\n\n<li><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-select\/\">SELECT<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-select-distinct\/\">DISTINCT<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-order-by\/\">ORDER BY<\/a><\/li>\n<\/ul>\n\n\n\n<p>Suppose we have the following <code>order_items<\/code> table:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>order_id<\/th><th>item_id<\/th><th>product_id<\/th><th>quantity<\/th><th>unit_price<\/th><\/tr><\/thead><tbody><tr><td>7<\/td><td>1<\/td><td>227<\/td><td>74<\/td><td>305.00<\/td><\/tr><tr><td>7<\/td><td>2<\/td><td>230<\/td><td>49<\/td><td>136.69<\/td><\/tr><tr><td>11<\/td><td>1<\/td><td>96<\/td><td>113<\/td><td>141.56<\/td><\/tr><tr><td>11<\/td><td>2<\/td><td>40<\/td><td>79<\/td><td>299.89<\/td><\/tr><tr><td>20<\/td><td>1<\/td><td>126<\/td><td>105<\/td><td>640.99<\/td><\/tr><tr><td>20<\/td><td>2<\/td><td>41<\/td><td>78<\/td><td>299.89<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>To retrieve the order id and total amount of each, we use the <code>GROUP BY<\/code> clause:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">SELECT<\/span>\n  order_id,\n  SUM(quantity * unit_price) total\n<span class=\"hljs-keyword\">FROM<\/span>\n  order_items\n<span class=\"hljs-keyword\">GROUP<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  order_id;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Here&#8217;s the result set:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>order_id<\/th><th>total<\/th><\/tr><\/thead><tbody><tr><td>7<\/td><td>29267.81<\/td><\/tr><tr><td>11<\/td><td>39687.59<\/td><\/tr><tr><td>20<\/td><td>90695.37<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>To retrieve only orders with a total greater than <code>30,000<\/code>, you use a <code>GROUP BY<\/code> clause:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">SELECT<\/span>\n  order_id,\n  SUM(quantity * unit_price) total\n<span class=\"hljs-keyword\">FROM<\/span>\n  order_items\n<span class=\"hljs-keyword\">WHERE<\/span>\n  order_id <span class=\"hljs-keyword\">IN<\/span> (<span class=\"hljs-number\">7<\/span>, <span class=\"hljs-number\">11<\/span>, <span class=\"hljs-number\">20<\/span>)\n<span class=\"hljs-keyword\">GROUP<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  order_id\n<span class=\"hljs-keyword\">HAVING<\/span>\n  SUM(quantity * unit_price) &gt; <span class=\"hljs-number\">30000<\/span>\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  order_id;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Here&#8217;s the final result:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>order_id<\/th><th>total<\/th><\/tr><\/thead><tbody><tr><td>11<\/td><td>39687.59<\/td><\/tr><tr><td>20<\/td><td>90695.37<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='oracle-having-clause-examples'>Oracle HAVING clause examples <a href=\"#oracle-having-clause-examples\" class=\"anchor\" id=\"oracle-having-clause-examples\" title=\"Anchor for Oracle HAVING clause examples\">#<\/a><\/h2>\n\n\n\n<p>We&#8217;ll use the <code>order_items<\/code> in the <a href=\"https:\/\/www.oracletutorial.com\/getting-started\/oracle-sample-database\/\">sample database<\/a> for the demonstration.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"144\" height=\"145\" src=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/order_items-table.png\" alt=\"Oracle HAVING - ORDER_ITEMS sample table\" class=\"wp-image-625\" title=\"Oracle HAVING - ORDER_ITEMS sample table\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id='basic-oracle-having-clause-example'>Basic Oracle HAVING clause example <a href=\"#basic-oracle-having-clause-example\" class=\"anchor\" id=\"basic-oracle-having-clause-example\" title=\"Anchor for Basic Oracle HAVING clause example\">#<\/a><\/h3>\n\n\n\n<p>The following statement uses the <code>GROUP BY<\/code> clause to retrieve the orders and their values from the <code>order_items<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span>\n  order_id,\n  <span class=\"hljs-keyword\">SUM<\/span>(unit_price * quantity) order_value\n<span class=\"hljs-keyword\">FROM<\/span>\n  order_items\n<span class=\"hljs-keyword\">GROUP<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  order_id\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  order_value <span class=\"hljs-keyword\">DESC<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.oracletutorial.com\/playground\/?q=U0VMRUNUIG9yZGVyX2lkLCBTVU0odW5pdF9wcmljZSAqIHF1YW50aXR5KSBvcmRlcl92YWx1ZSBGUk9NIG9yZGVyX2l0ZW1zIEdST1VQIEJZIG9yZGVyX2lkIE9SREVSIEJZIG9yZGVyX3ZhbHVlIERFU0M7\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Here is the result:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"162\" height=\"259\" src=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/09\/Oracle-HAVING-GROUP-BY-example.png\" alt=\"Oracle HAVING - GROUP BY example\" class=\"wp-image-769\"\/><\/figure>\n\n\n\n<p>In this example, we use the <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-aggregate-functions\/oracle-sum\/\">SUM()<\/a><\/code> aggregate function calculates the total amount of each order.<\/p>\n\n\n\n<p>To find the orders whose values are greater than 1 million, you use a <code>HAVING<\/code> clause as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span>\n  order_id,\n  <span class=\"hljs-keyword\">SUM<\/span>(unit_price * quantity) order_value\n<span class=\"hljs-keyword\">FROM<\/span>\n  order_items\n<span class=\"hljs-keyword\">GROUP<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  order_id\n<span class=\"hljs-keyword\">HAVING<\/span>\n  <span class=\"hljs-keyword\">SUM<\/span>(unit_price * quantity) &gt; <span class=\"hljs-number\">1000000<\/span>\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  order_value <span class=\"hljs-keyword\">DESC<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.oracletutorial.com\/playground\/?q=U0VMRUNUIG9yZGVyX2lkLCBTVU0odW5pdF9wcmljZSAqIHF1YW50aXR5KSBvcmRlcl92YWx1ZSBGUk9NIG9yZGVyX2l0ZW1zIEdST1VQIEJZIG9yZGVyX2lkIEhBVklORyBTVU0odW5pdF9wcmljZSAqIHF1YW50aXR5KSA%2BIDEwMDAwMDAgT1JERVIgQlkgb3JkZXJfdmFsdWUgREVTQzs%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"162\" height=\"198\" src=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/09\/Oracle-HAVING-filter-groups-example.png\" alt=\"Oracle HAVING - filter groups example\" class=\"wp-image-770\" title=\"Oracle HAVING - filter groups example\"\/><\/figure>\n\n\n\n<p>In this example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, the <code>GROUP BY<\/code> clause groups orders by their ids and calculates the order values using the <code><code><a href=\"https:\/\/www.oracletutorial.com\/oracle-aggregate-functions\/oracle-sum\/\">SUM()<\/a><\/code><\/code> function.<\/li>\n\n\n\n<li>Then, the <code>HAVING<\/code> clause filters all orders whose values are less than or equal to <code>1,000,000<\/code>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id='using-oracle-having-with-complex-conditions-example'>Using Oracle HAVING with complex conditions example <a href=\"#using-oracle-having-with-complex-conditions-example\" class=\"anchor\" id=\"using-oracle-having-with-complex-conditions-example\" title=\"Anchor for Using Oracle HAVING with complex conditions example\">#<\/a><\/h3>\n\n\n\n<p>You can use a complex filter condition in the <code>HAVING<\/code> clause to filter groups.<\/p>\n\n\n\n<p>For example, the following statement finds orders whose values are greater than <code>500,000<\/code> and the number of products in each order is between 10 and 12:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span>\n  order_id,\n  <span class=\"hljs-keyword\">COUNT<\/span>(item_id) item_count,\n  <span class=\"hljs-keyword\">SUM<\/span>(unit_price * quantity) total\n<span class=\"hljs-keyword\">FROM<\/span>\n  order_items\n<span class=\"hljs-keyword\">GROUP<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  order_id\n<span class=\"hljs-keyword\">HAVING<\/span>\n  <span class=\"hljs-keyword\">SUM<\/span>(unit_price * quantity) &gt; <span class=\"hljs-number\">500000<\/span>\n  <span class=\"hljs-keyword\">AND<\/span> <span class=\"hljs-keyword\">COUNT<\/span>(item_id) <span class=\"hljs-keyword\">BETWEEN<\/span> <span class=\"hljs-number\">10<\/span> <span class=\"hljs-keyword\">AND<\/span> <span class=\"hljs-number\">12<\/span>\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  total <span class=\"hljs-keyword\">DESC<\/span>,\n  item_count <span class=\"hljs-keyword\">DESC<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.oracletutorial.com\/playground\/?q=U0VMRUNUIG9yZGVyX2lkLCBDT1VOVChpdGVtX2lkKSBpdGVtX2NvdW50LCBTVU0odW5pdF9wcmljZSAqIHF1YW50aXR5KSB0b3RhbCBGUk9NIG9yZGVyX2l0ZW1zIEdST1VQIEJZIG9yZGVyX2lkIEhBVklORyBTVU0odW5pdF9wcmljZSAqIHF1YW50aXR5KSA%2BIDUwMDAwMCBBTkQgQ09VTlQoaXRlbV9pZCkgQkVUV0VFTiAxMCBBTkQgMTIgT1JERVIgQlkgdG90YWwgREVTQywgaXRlbV9jb3VudCBERVNDOw%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"227\" height=\"277\" src=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/09\/Oracle-HAVING-complex-condition-example.png\" alt=\"Oracle HAVING - complex condition example\" class=\"wp-image-771\" title=\"Oracle HAVING - complex condition example\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the Oracle <code>HAVING<\/code> clause to filter groups of rows returned by the <code>GROUP BY<\/code> clause.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='quiz'>Quiz <a href=\"#quiz\" class=\"anchor\" id=\"quiz\" title=\"Anchor for Quiz\">#<\/a><\/h2>\n\n\n\n<iframe loading=\"lazy\"\n  name=\"quiz\"\n  src=\"\/quiz\/?quiz=having\"\n  height=\"700\"\n  width=\"600\"\n  class=\"iframe\"\n><\/iframe>\n\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"768\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/\"\n\t\t\t\tdata-post-title=\"Oracle HAVING Clause\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"768\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/\"\n\t\t\t\tdata-post-title=\"Oracle HAVING Clause\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows you how to use the Oracle HAVING clause to filter groups of rows returned by the GROUP BY clause.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":386,"menu_order":19,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-768","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Oracle HAVING Clause<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use the Oracle HAVING clause to filter groups of rows returned by the GROUP BY clause.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Oracle HAVING Clause\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use the Oracle HAVING clause to filter groups of rows returned by the GROUP BY clause.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/\" \/>\n<meta property=\"og:site_name\" content=\"Oracle Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-04T12:22:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/order_items-table.png\" \/>\n\t<meta property=\"og:image:width\" content=\"144\" \/>\n\t<meta property=\"og:image:height\" content=\"145\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/oracle-having\\\/\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/oracle-having\\\/\",\"name\":\"Oracle HAVING Clause\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/oracle-having\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/oracle-having\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/order_items-table.png\",\"datePublished\":\"2017-09-09T04:12:20+00:00\",\"dateModified\":\"2025-05-04T12:22:42+00:00\",\"description\":\"This tutorial shows you how to use the Oracle HAVING clause to filter groups of rows returned by the GROUP BY clause.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/oracle-having\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/oracle-having\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/oracle-having\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/order_items-table.png\",\"contentUrl\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/order_items-table.png\",\"width\":144,\"height\":145,\"caption\":\"order_items table\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/oracle-having\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.oracletutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Oracle Basics\",\"item\":\"https:\\\/\\\/www.oracletutorial.com\\\/oracle-basics\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Oracle HAVING Clause\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/\",\"name\":\"Oracle Tutorial\",\"description\":\"Oracle Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.oracletutorial.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Oracle HAVING Clause","description":"This tutorial shows you how to use the Oracle HAVING clause to filter groups of rows returned by the GROUP BY clause.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/","og_locale":"en_US","og_type":"article","og_title":"Oracle HAVING Clause","og_description":"This tutorial shows you how to use the Oracle HAVING clause to filter groups of rows returned by the GROUP BY clause.","og_url":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/","og_site_name":"Oracle Tutorial","article_modified_time":"2025-05-04T12:22:42+00:00","og_image":[{"width":144,"height":145,"url":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/order_items-table.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/","url":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/","name":"Oracle HAVING Clause","isPartOf":{"@id":"https:\/\/www.oracletutorial.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/#primaryimage"},"image":{"@id":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/#primaryimage"},"thumbnailUrl":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/order_items-table.png","datePublished":"2017-09-09T04:12:20+00:00","dateModified":"2025-05-04T12:22:42+00:00","description":"This tutorial shows you how to use the Oracle HAVING clause to filter groups of rows returned by the GROUP BY clause.","breadcrumb":{"@id":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/#primaryimage","url":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/order_items-table.png","contentUrl":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/order_items-table.png","width":144,"height":145,"caption":"order_items table"},{"@type":"BreadcrumbList","@id":"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.oracletutorial.com\/"},{"@type":"ListItem","position":2,"name":"Oracle Basics","item":"https:\/\/www.oracletutorial.com\/oracle-basics\/"},{"@type":"ListItem","position":3,"name":"Oracle HAVING Clause"}]},{"@type":"WebSite","@id":"https:\/\/www.oracletutorial.com\/#website","url":"https:\/\/www.oracletutorial.com\/","name":"Oracle Tutorial","description":"Oracle Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.oracletutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/768","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/comments?post=768"}],"version-history":[{"count":0,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/768\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/386"}],"wp:attachment":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/media?parent=768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}