{"id":8486,"date":"2020-12-03T07:37:00","date_gmt":"2020-12-03T07:37:00","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=8486"},"modified":"2025-08-29T04:31:17","modified_gmt":"2025-08-29T04:31:17","slug":"how-to-compare-arrays-in-postgresql","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/","title":{"rendered":"How To Compare Arrays in PostgreSQL"},"content":{"rendered":"\n<p>PostgreSQL supports numerous data types including complex ones such as arrays. You easily create arrays, insert values into arrays, update arrays and even check if array contains a value. Often database programmers and web developers need to compare arrays in PostgreSQL. It can be tedious to perform such a comparison from scratch. Luckily PostgreSQL provides several straight forward operators for this purpose. In this article, we will look at how to compare arrays in PostgreSQL database.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#How_To_Compare_Arrays_in_PostgreSQL\" >How To Compare Arrays in PostgreSQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#Compare_Arrays_for_Equality\" >Compare Arrays for Equality<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#Compare_Arrays_for_Order\" >Compare Arrays for Order<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#Compare_Arrays_for_Containment\" >Compare Arrays for Containment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#Compare_Arrays_for_Overlap\" >Compare Arrays for Overlap<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_To_Compare_Arrays_in_PostgreSQL\"><\/span>How To Compare Arrays in PostgreSQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>PostgreSQL allows you to compare arrays using equality operators (=, &lt;&gt;), ordering operators (&gt;, &lt;, &gt;=, &lt;=), containment operators (@&gt;, &lt;@) and overlap operators (&amp;&amp;). Each of these operators has a different purpose.<\/p>\n\n\n\n<p>However, in case of each of these operators, after PostgreSQL compares arrays, it returns t for true or f for false as result.<\/p>\n\n\n\n<p>Let us look at each of these operators one by one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Compare_Arrays_for_Equality\"><\/span>Compare Arrays for Equality<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Equality operators do an element-by-element comparison to check if the two arrays are equal or not. &#8216;=&#8217; operator is used to check if two arrays are equal whereas &#8216;&lt;&gt;&#8217; operator is used to check if two arrays are not equal.<\/p>\n\n\n\n<p>Here are sample SQL queries to compare two arrays using equality operators. The following two arrays are not equal. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">postgres=# select array[2,3,4] = array[1,2,5] as compare;\n compare\n---------\n f\n\npostgres=# select <code>array[2,3,4] &lt;&gt; array[1,2,5]<\/code> as compare;\n compare\n---------\n t<\/pre>\n\n\n\n<p>In the first query, we check if two arrays are equal, which returns false. In second query, if the same two arrays are not equal, which returns true.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Compare_Arrays_for_Order\"><\/span>Compare Arrays for Order<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Ordering operators (&gt;, &lt;, &gt;=, &lt;=) do an element-by-element comparison between two arrays to check if each pair of elements follow the required order condition. If there is no mismatch it returns t, else f. Please note, the comparison result is not based on size of arrays but on the first different pair of elements.<\/p>\n\n\n\n<p>Here is an example<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">postgres=# select\n           array[1,3,5] &gt;= array[1,3,4] as compare1,\n           array[1,3,5] &lt;= array[1,3,4,5] as compare2;\n compare1 | compare2\n----------+----------\n t        | f<\/pre>\n\n\n\n<p>In the first comparison, each element of first array is &gt;= each element of second array. Hence, you get true. In second comparison, the first array does not have 4th element, required for comparison with 4th element of second array. Therefore, comparison fails and you get false as a result.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Compare_Arrays_for_Containment\"><\/span>Compare Arrays for Containment<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Containment operators (&lt;@, @&gt;) allow you to check if one array contains another array using @&gt; operator, or if one array is contained by another array using &lt;@ operator. @&gt; operator checks if left array contains right array whereas &lt;@ checks if right array contains left array.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><br>postgres=# select array['b', 'c', 'd'] @&gt; array['b', 'c'] as contains;<br> contains<br>----------<br> t<br><br>postgres=# select array[1, 2, 4] &lt;@ array[4, 5, 2, 1] as is_contained_by;<br> is_contained_by<br>-----------------<br> t<\/pre>\n\n\n\n<p>In the first example, we check if elements of array[&#8216;b&#8217;, &#8216;c&#8217;, &#8216;d&#8217;] contain elements of array[&#8216;b&#8217;, &#8216;c&#8217;]. In the second example, we check if array[1, 2, 4] is contained by array[4, 5, 2, 1].<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Compare_Arrays_for_Overlap\"><\/span>Compare Arrays for Overlap<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Overlap operator (&amp;&amp;) lets you check if there are any common elements in two arrays.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">postgres=# select\npostgres-# array[2, 4] &amp;&amp; array[4, 3] as overlap1,\npostgres-# array[0, 2] &amp;&amp; array[1, 4] as overlap2;\n overlap1 | overlap2\n----------+----------\n t        | f\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt several simple ways to quickly compare PostgreSQL arrays. The equality operator checks if two arrays are equal or not, ordering operators compare the order of items in two arrays, containment operator checks if one array is present in another, and overlap operator checks if the arrays overlap each other. Depending on your requirement, you can use the appropriate operator. Without them, it would have been really difficult to compare arrays.<\/p>\n\n\n\n<p>Need a reporting tool for PostgreSQL? <a href=\"http:\/\/ubiq.co\/\">Ubiq<\/a>&nbsp;makes it easy to visualize data in minutes, and monitor in real-time dashboards.&nbsp;<a href=\"http:\/\/ubiq.co\/accounts\/register\">Try it<\/a>&nbsp;Today!<\/p>\n\n\n\n<p>Also read:<br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-user-with-superuser-privileges-in-postgresql\/\">How to Create Superuser in PostgreSQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-setup-remote-connection-to-postgresql\/\">How to Setup Remote Connection in PostgreSQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-two-schemas-in-postgresql\/\">How to Compare Schemas in PostgreSQL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL allows you to compare arrays using operators. Here is how to compare arrays in PostgreSQL.<\/p>\n","protected":false},"author":1,"featured_media":8488,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[348],"tags":[470],"class_list":["post-8486","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-postgresql","tag-compare-arrays"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Compare Arrays in PostgreSQL - Ubiq BI<\/title>\n<meta name=\"description\" content=\"PostgreSQL allows you to compare arrays using operators. Here is how to compare arrays in PostgreSQL.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Compare Arrays in PostgreSQL - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"PostgreSQL allows you to compare arrays using operators. Here is how to compare arrays in PostgreSQL.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-03T07:37:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-29T04:31:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/compare-arrays-postgresql.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"500\" \/>\n\t<meta property=\"og:image:height\" content=\"410\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How To Compare Arrays in PostgreSQL\",\"datePublished\":\"2020-12-03T07:37:00+00:00\",\"dateModified\":\"2025-08-29T04:31:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/\"},\"wordCount\":590,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1\",\"keywords\":[\"compare arrays\"],\"articleSection\":[\"PostgreSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/\",\"name\":\"How To Compare Arrays in PostgreSQL - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1\",\"datePublished\":\"2020-12-03T07:37:00+00:00\",\"dateModified\":\"2025-08-29T04:31:17+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"PostgreSQL allows you to compare arrays using operators. Here is how to compare arrays in PostgreSQL.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1\",\"width\":500,\"height\":410,\"caption\":\"compare arrays in postgresql\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-compare-arrays-in-postgresql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Compare Arrays in PostgreSQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Compare Arrays in PostgreSQL - Ubiq BI","description":"PostgreSQL allows you to compare arrays using operators. Here is how to compare arrays in PostgreSQL.","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:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/","og_locale":"en_US","og_type":"article","og_title":"How To Compare Arrays in PostgreSQL - Ubiq BI","og_description":"PostgreSQL allows you to compare arrays using operators. Here is how to compare arrays in PostgreSQL.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-12-03T07:37:00+00:00","article_modified_time":"2025-08-29T04:31:17+00:00","og_image":[{"width":500,"height":410,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/compare-arrays-postgresql.webp","type":"image\/webp"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How To Compare Arrays in PostgreSQL","datePublished":"2020-12-03T07:37:00+00:00","dateModified":"2025-08-29T04:31:17+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/"},"wordCount":590,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1","keywords":["compare arrays"],"articleSection":["PostgreSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/","name":"How To Compare Arrays in PostgreSQL - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1","datePublished":"2020-12-03T07:37:00+00:00","dateModified":"2025-08-29T04:31:17+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"PostgreSQL allows you to compare arrays using operators. Here is how to compare arrays in PostgreSQL.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1","width":500,"height":410,"caption":"compare arrays in postgresql"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-compare-arrays-in-postgresql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How To Compare Arrays in PostgreSQL"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/compare-arrays-postgresql.webp?fit=500%2C410&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-2cS","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=8486"}],"version-history":[{"count":2,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8486\/revisions"}],"predecessor-version":[{"id":9337,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8486\/revisions\/9337"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/8488"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=8486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=8486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=8486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}