<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Vertica Documentation – Predicates</title>
    <link>/en/sql-reference/language-elements/predicates/</link>
    <description>Recent content in Predicates on Vertica Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/language-elements/predicates/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: ANY and ALL</title>
      <link>/en/sql-reference/language-elements/predicates/any-and-all/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/predicates/any-and-all/</guid>
      <description>
        
        
        &lt;p&gt;ANY and ALL are logical operators that let you make comparisons on subqueries that return one or more rows. Both operators must be preceded by a &lt;a href=&#34;../../../../en/sql-reference/language-elements/operators/comparison-operators/&#34;&gt;comparison operator&lt;/a&gt; and followed by a subquery:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; &lt;span class=&#34;code-variable&#34;&gt;comparison-operator&lt;/span&gt; { ANY | ALL } (&lt;span class=&#34;code-variable&#34;&gt;subquery&lt;/span&gt;)
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;ANY returns true if the comparison between &lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt; and any value returned by &lt;em&gt;&lt;code&gt;subquery&lt;/code&gt;&lt;/em&gt; evaluates to true.&lt;/li&gt;
&lt;li&gt;ALL returns true only if the comparison between &lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt; and all values returned by &lt;em&gt;&lt;code&gt;subquery&lt;/code&gt;&lt;/em&gt; evaluates to true.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;equivalent-operators&#34;&gt;Equivalent operators&lt;/h2&gt;
&lt;p&gt;You can use the following operators instead of ANY or ALL:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
This operator...&lt;/th&gt; 

&lt;th &gt;
Is equivalent to:&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
SOME&lt;/td&gt; 

&lt;td &gt;
ANY&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
IN&lt;/td&gt; 

&lt;td &gt;
= ANY&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
NOT IN&lt;/td&gt; 

&lt;td &gt;
&amp;lt;&amp;gt; ALL&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h2 id=&#34;null-handling&#34;&gt;NULL handling&lt;/h2&gt;
&lt;p&gt;Vertica supports multicolumn &amp;lt;&amp;gt; ALL subqueries where the columns are not marked &lt;code&gt;NOT NULL&lt;/code&gt;. If any column contains a NULL value, Vertica returns a run-time error.&lt;/p&gt;
&lt;p&gt;Vertica does not support ANY subqueries that are nested in another expression if any column values are NULL.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Examples below use the following tables and data:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t1 ORDER BY c1;
 c1 | c2
----+-----
  1 | cab
  1 | abc
  2 | fed
  2 | def
  3 | ihg
  3 | ghi
  4 | jkl
  5 | mno
(8 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t2 ORDER BY c1;
 c1 | c2
----+-----
  1 | abc
  2 | fed
  3 | jkl
  3 | stu
  3 | zzz
(5 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a name=&#34;Examples&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;any-subqueries&#34;&gt;ANY subqueries&lt;/h3&gt;
&lt;p&gt;Subqueries that use the ANY keyword return true when any value retrieved in the subquery matches the value of the left-hand expression.&lt;/p&gt;
&lt;p&gt;ANY subquery within an expression:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1, c2 FROM t1 WHERE COALESCE((t1.c1 &amp;gt; ANY (SELECT c1 FROM t2)));
 c1 | c2
----+-----
  2 | fed
  2 | def
  3 | ihg
  3 | ghi
  4 | jkl
  5 | mno
(6 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ANY noncorrelated subqueries without aggregates:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1 FROM t1 WHERE c1 = ANY (SELECT c1 FROM t2) ORDER BY c1;
 c1
----
  1
  1
  2
  2
  3
  3
(6 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ANY noncorrelated subqueries with aggregates:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT c1, c2 FROM t1 WHERE c1 &amp;lt;&amp;gt; ANY (SELECT MAX(c1) FROM t2) ORDER BY c1;
 c1 | c2
----+-----
  1 | cab
  1 | abc
  2 | fed
  2 | def
  4 | jkl
  5 | mno
(6 rows)

=&amp;gt; SELECT c1 FROM t1 GROUP BY c1 HAVING c1 &amp;lt;&amp;gt; ANY (SELECT MAX(c1) FROM t2) ORDER BY c1;
 c1
----
  1
  2
  4
  5
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ANY noncorrelated subqueries with aggregates and a GROUP BY clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT c1, c2 FROM t1 WHERE c1 &amp;lt;&amp;gt; ANY (SELECT MAX(c1) FROM t2 GROUP BY c2) ORDER BY c1;
 c1 | c2
----+-----
  1 | cab
  1 | abc
  2 | fed
  2 | def
  3 | ihg
  3 | ghi
  4 | jkl
  5 | mno
(8 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ANY noncorrelated subqueries with a GROUP BY clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1, c2 FROM t1 WHERE c1 &amp;lt;=&amp;gt; ANY (SELECT c1 FROM t2 GROUP BY c1) ORDER BY c1;
 c1 | c2
----+-----
  1 | cab
  1 | abc
  2 | fed
  2 | def
  3 | ihg
  3 | ghi
(6 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ANY correlated subqueries with no aggregates or GROUP BY clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1, c2 FROM t1 WHERE c1 &amp;gt;= ANY (SELECT c1 FROM t2 WHERE t2.c2 = t1.c2) ORDER BY c1;
 c1 | c2
----+-----
  1 | abc
  2 | fed
  4 | jkl
(3 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;all-subqueries&#34;&gt;ALL subqueries&lt;/h3&gt;
&lt;p&gt;A subquery that uses the ALL keyword returns true when all values retrieved by the subquery match the left-hand expression, otherwise it returns false.&lt;/p&gt;
&lt;p&gt;ALL noncorrelated subqueries without aggregates:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1, c2 FROM t1 WHERE c1 &amp;gt;= ALL (SELECT c1 FROM t2) ORDER BY c1;
 c1 | c2
----+-----
  3 | ihg
  3 | ghi
  4 | jkl
  5 | mno
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ALL noncorrelated subqueries with aggregates:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1, c2 FROM t1 WHERE c1 = ALL (SELECT MAX(c1) FROM t2) ORDER BY c1;
 c1 | c2
----+-----
  3 | ihg
  3 | ghi
(2 rows)

=&amp;gt; SELECT c1 FROM t1 GROUP BY c1 HAVING c1 &amp;lt;&amp;gt; ALL (SELECT MAX(c1) FROM t2) ORDER BY c1;
 c1
----
  1
  2
  4
  5
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ALL noncorrelated subqueries with aggregates and a GROUP BY clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT c1, c2 FROM t1 WHERE c1 &amp;lt;= ALL (SELECT MAX(c1) FROM t2 GROUP BY c2) ORDER BY c1;
 c1 | c2
----+-----
  1 | cab
  1 | abc
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ALL noncorrelated subqueries with a GROUP BY clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1, c2 FROM t1 WHERE c1 &amp;lt;&amp;gt; ALL (SELECT c1 FROM t2 GROUP BY c1) ORDER BY c1;
 c1 | c2
----+-----
  4 | jkl
  5 | mno
(2 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: BETWEEN</title>
      <link>/en/sql-reference/language-elements/predicates/between/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/predicates/between/</guid>
      <description>
        
        
        &lt;p&gt;Checks whether an expression is within the range of two other expressions, inclusive. All expressions must be of the same or compatible data types.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;WHERE &lt;span class=&#34;code-variable&#34;&gt;a&lt;/span&gt; BETWEEN &lt;span class=&#34;code-variable&#34;&gt;x&lt;/span&gt; AND &lt;span class=&#34;code-variable&#34;&gt;y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;equivalent-predicates&#34;&gt;Equivalent predicates&lt;/h2&gt;
&lt;p&gt;The following BETWEEN predicates can be rewritten in conventional SQL with logical operators AND and OR.

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
This BETWEEN predicate...&lt;/th&gt; 

&lt;th &gt;
Is equivalent to...&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;WHERE &lt;/code&gt;&lt;em&gt;&lt;code&gt;a&lt;/code&gt;&lt;/em&gt;&lt;code&gt;BETWEEN&lt;/code&gt;&lt;em&gt;&lt;code&gt;x&lt;/code&gt;&lt;/em&gt;&lt;code&gt;AND&lt;/code&gt;&lt;em&gt;&lt;code&gt;y &lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;


&lt;code&gt;WHERE &lt;/code&gt;&lt;em&gt;&lt;code&gt;a&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&amp;gt;=&lt;/code&gt;&lt;em&gt;&lt;code&gt;x&lt;/code&gt;&lt;/em&gt;&lt;code&gt;AND&lt;/code&gt;&lt;em&gt;&lt;code&gt;a&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&amp;lt;=&lt;/code&gt;&lt;em&gt;&lt;code&gt;y&lt;/code&gt;&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;WHERE &lt;/code&gt;&lt;em&gt;&lt;code&gt;a&lt;/code&gt;&lt;/em&gt;&lt;code&gt;NOT BETWEEN&lt;/code&gt;&lt;em&gt;&lt;code&gt;x&lt;/code&gt;&lt;/em&gt;&lt;code&gt;AND&lt;/code&gt;&lt;em&gt;&lt;code&gt;y&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;


&lt;code&gt;WHERE &lt;/code&gt;&lt;em&gt;&lt;code&gt;a&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&amp;lt;&lt;/code&gt;&lt;em&gt;&lt;code&gt;x&lt;/code&gt;&lt;/em&gt;&lt;code&gt;OR&lt;/code&gt;&lt;em&gt;&lt;code&gt;a&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&amp;gt;&lt;/code&gt;&lt;em&gt;&lt;code&gt;y&lt;/code&gt;&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The BETWEEN predicate can be especially useful for querying date ranges, as shown in the following examples:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT NOW()::DATE;
    NOW
------------
 2022-12-15
(1 row)

=&amp;gt; CREATE TABLE t1 (a INT, b varchar(12), c DATE);
CREATE TABLE
=&amp;gt; INSERT INTO t1 VALUES
    (0,&amp;#39;today&amp;#39;,NOW()),
    (1,&amp;#39;today+1&amp;#39;,NOW()+1),
    (2,&amp;#39;today+2&amp;#39;,NOW()+2),
    (3,&amp;#39;today+3&amp;#39;,NOW()+3),
    (4,&amp;#39;today+4&amp;#39;,NOW()+4),
    (5,&amp;#39;today+5&amp;#39;,NOW()+5),
    (6,&amp;#39;today+6&amp;#39;,NOW()+6);
 OUTPUT
--------
      7
(1 row)

=&amp;gt; COMMIT;
COMMIT
=&amp;gt; SELECT * FROM t1;
 a |    b    |     c
---+---------+------------
 0 | today   | 2022-12-15
 1 | today+1 | 2022-12-16
 2 | today+2 | 2022-12-17
 3 | today+3 | 2022-12-18
 4 | today+4 | 2022-12-19
 5 | today+5 | 2022-12-20
 6 | today+6 | 2022-12-21
(7 rows)

=&amp;gt; SELECT * FROM t1 WHERE c BETWEEN &amp;#39;2022-12-17&amp;#39; AND &amp;#39;2022-12-20&amp;#39;;
 a |    b    |     c
---+---------+------------
 2 | today+2 | 2022-12-17
 3 | today+3 | 2022-12-18
 4 | today+4 | 2022-12-19
 5 | today+5 | 2022-12-20
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use the NOW and INTERVAL keywords to query a date range:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t1 WHERE c BETWEEN NOW()::DATE AND NOW()::DATE + INTERVAL &amp;#39;2 days&amp;#39;;
 a |    b    |     c
---+---------+------------
 0 | today   | 2022-12-15
 1 | today+1 | 2022-12-16
 2 | today+2 | 2022-12-17
(3 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Boolean</title>
      <link>/en/sql-reference/language-elements/predicates/boolean/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/predicates/boolean/</guid>
      <description>
        
        
        &lt;p&gt;Retrieves rows where the value of an expression is true, false, or unknown (NULL).&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; IS [NOT] TRUE
&lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; IS [NOT] FALSE
&lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; IS [NOT] UNKNOWN
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;NULL input is treated as the value &lt;code&gt;UNKNOWN&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;IS UNKNOWN&lt;/code&gt; and &lt;code&gt;IS NOT UNKNOWN&lt;/code&gt; are effectively the same as the &lt;a href=&#34;../../../../en/sql-reference/language-elements/predicates/null/&#34;&gt;NULL predicate&lt;/a&gt;, except that the input expression does not have to be a single column value. To check a single column value for NULL, use the NULL predicate.&lt;/li&gt;
&lt;li&gt;Do not confuse the Boolean predicate with &lt;a href=&#34;../../../../en/sql-reference/language-elements/operators/logical-operators/&#34;&gt;Boolean operators&lt;/a&gt; or the &lt;a href=&#34;../../../../en/sql-reference/data-types/boolean-data-type/&#34;&gt;Boolean&lt;/a&gt; data type, which can have only two values: true and false.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: EXISTS</title>
      <link>/en/sql-reference/language-elements/predicates/exists/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/predicates/exists/</guid>
      <description>
        
        
        &lt;p&gt;EXISTS and NOT EXISTS predicates compare an expression against a subquery:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;EXISTS returns true if the subquery returns one or more rows.&lt;/li&gt;
&lt;li&gt;NOT EXISTS returns true if the subquery returns no rows.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; [ NOT ] EXISTS ( &lt;span class=&#34;code-variable&#34;&gt;subquery&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;
&lt;p&gt;EXISTS results only depend on whether any or no records are returned, and not on the contents of those records. Because the subquery output is usually of no interest, EXISTS tests are commonly written in one of the following ways:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;EXISTS (SELECT 1 WHERE...)
EXISTS (SELECT * WHERE...)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the first case, the subquery returns 1 for every record found by the subquery. For example, the following query retrieves a list of all customers whose store purchases were greater than 550 dollars:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT customer_key, customer_name, customer_state
   FROM public.customer_dimension WHERE EXISTS
     (SELECT 1 FROM store.store_sales_fact
      WHERE customer_key = public.customer_dimension.customer_key
      AND sales_dollar_amount &amp;gt; 550)
   AND customer_state = &amp;#39;MA&amp;#39; ORDER BY customer_key;
 customer_key |     customer_name      | customer_state
--------------+------------------------+----------------
            2 | Anna G. Li              | CA
            4 | Daniel I. Fortin        | TX
            7 | David H. Greenwood      | MA
            8 | Wendy S. Young          | IL
            9 | Theodore X. Brown       | MA
      ...
        49902 | Amy Q. Pavlov          | MA
        49922 | Doug C. Carcetti       | MA
        49930 | Theodore G. McNulty    | MA
        49979 | Ben Z. Miller          | MA
(1058 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;exists-versus-in&#34;&gt;EXISTS versus IN&lt;/h2&gt;
&lt;p&gt;Whether you use EXISTS or IN subqueries depends on which predicates you select in outer and inner query blocks. For example, the following query gets a list of all the orders placed by all stores on January 2, 2007 for vendors with records in the vendor table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT store_key, order_number, date_ordered
   FROM store.store_orders_fact WHERE EXISTS
     (SELECT 1 FROM public.vendor_dimension vd JOIN store.store_orders_fact ord ON vd.vendor_key = ord.vendor_key)
   AND date_ordered = &amp;#39;2007-01-02&amp;#39;;
 store_key | order_number | date_ordered
-----------+--------------+--------------
       114 |       271071 | 2007-01-02
        19 |       290888 | 2007-01-02
       132 |        58942 | 2007-01-02
       232 |         9286 | 2007-01-02
       126 |       224474 | 2007-01-02
       196 |        63482 | 2007-01-02
  ...
       196 |        83327 | 2007-01-02
       138 |       278373 | 2007-01-02
       179 |       293586 | 2007-01-02
       155 |       213413 | 2007-01-02
(506 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The above query looks for existence of the vendor and date ordered. To return a particular value, rather than simple existence, the query looks for orders placed by the vendor who got the best deal on January 2, 2007:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT store_key, order_number, date_ordered, vendor_name
   FROM store.store_orders_fact ord JOIN public.vendor_dimension vd ON ord.vendor_key = vd.vendor_key
   WHERE vd.deal_size IN (SELECT MAX(deal_size) FROM public.vendor_dimension) AND date_ordered = &amp;#39;2007-01-02&amp;#39;;
 store_key | order_number | date_ordered |     vendor_name
-----------+--------------+--------------+----------------------
        50 |        99234 | 2007-01-02   | Everything Wholesale
        81 |       200802 | 2007-01-02   | Everything Wholesale
       115 |        13793 | 2007-01-02   | Everything Wholesale
       204 |        41842 | 2007-01-02   | Everything Wholesale
       133 |       169025 | 2007-01-02   | Everything Wholesale
       163 |       208580 | 2007-01-02   | Everything Wholesale
        29 |       154972 | 2007-01-02   | Everything Wholesale
       145 |       236790 | 2007-01-02   | Everything Wholesale
       249 |        54838 | 2007-01-02   | Everything Wholesale
         7 |       161536 | 2007-01-02   | Everything Wholesale
(10 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/sql-reference/language-elements/predicates/in/&#34;&gt;IN&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: IN</title>
      <link>/en/sql-reference/language-elements/predicates/in/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/predicates/in/</guid>
      <description>
        
        
        &lt;p&gt;Checks whether a single value is found (or not found) within a set of values.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;(&lt;span class=&#34;code-variable&#34;&gt;column‑list&lt;/span&gt;) [ NOT ] IN ( &lt;span class=&#34;code-variable&#34;&gt;values‑list&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;


&lt;em&gt;&lt;code&gt;column‑list&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;


One or more comma-delimited columns in the queried tables.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;em&gt;&lt;code&gt;values‑list&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;






&lt;p&gt;Comma-delimited list of constant values to find in the &lt;em&gt;&lt;code&gt;column‑list&lt;/code&gt;&lt;/em&gt; columns. Each &lt;em&gt;&lt;code&gt;values‑list&lt;/code&gt;&lt;/em&gt; value maps to a &lt;em&gt;&lt;code&gt;column‑list&lt;/code&gt;&lt;/em&gt; column according to their order in &lt;em&gt;&lt;code&gt;values‑list&lt;/code&gt;&lt;/em&gt; and &lt;em&gt;&lt;code&gt;column‑list&lt;/code&gt;&lt;/em&gt;, respectively. Column/value pairs must have &lt;a href=&#34;../../../../en/sql-reference/data-types/data-type-coercion-chart/&#34;&gt;compatible&lt;/a&gt; data types.&lt;/p&gt;
&lt;p&gt;You can specify multiple sets of values as follows:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;( (&lt;/code&gt;&lt;em&gt;&lt;code&gt;values‑list&lt;/code&gt;&lt;/em&gt;&lt;code&gt;), (&lt;/code&gt;&lt;em&gt;&lt;code&gt;values‑list&lt;/code&gt;&lt;/em&gt;&lt;code&gt;)[,...] )&lt;/code&gt;&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;null-handling&#34;&gt;Null handling&lt;/h2&gt;
&lt;p&gt;Vertica supports multicolumn NOT IN subqueries where the columns are not marked 
&lt;code&gt;&lt;a href=&#34;../../../../en/admin/constraints/supported-constraints/not-null-constraints/&#34;&gt;NOT NULL&lt;/a&gt;&lt;/code&gt;. If one of the columns is found to contain a NULL value during query execution, Vertica returns a run-time error.&lt;/p&gt;
&lt;p&gt;Similarly, IN subqueries nested within another expression are not supported if any column values are NULL. For example, if in the following statement column &lt;code&gt;x&lt;/code&gt; from either table contains a NULL value, Vertica returns a run-time error:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t1 WHERE (x IN (SELECT x FROM t2)) IS FALSE;
   ERROR: NULL value found in a column used by a subquery
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;exists-versus-in&#34;&gt;EXISTS versus IN&lt;/h2&gt;
&lt;p&gt;Whether you use EXISTS or IN subqueries depends on which predicates you select in outer and inner query blocks. For example, the following query gets a list of all the orders placed by all stores on January 2, 2007 for vendors with records in the vendor table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT store_key, order_number, date_ordered
   FROM store.store_orders_fact WHERE EXISTS
     (SELECT 1 FROM public.vendor_dimension vd JOIN store.store_orders_fact ord ON vd.vendor_key = ord.vendor_key)
   AND date_ordered = &amp;#39;2007-01-02&amp;#39;;
 store_key | order_number | date_ordered
-----------+--------------+--------------
       114 |       271071 | 2007-01-02
        19 |       290888 | 2007-01-02
       132 |        58942 | 2007-01-02
       232 |         9286 | 2007-01-02
       126 |       224474 | 2007-01-02
       196 |        63482 | 2007-01-02
  ...
       196 |        83327 | 2007-01-02
       138 |       278373 | 2007-01-02
       179 |       293586 | 2007-01-02
       155 |       213413 | 2007-01-02
(506 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The above query looks for existence of the vendor and date ordered. To return a particular value, rather than simple existence, the query looks for orders placed by the vendor who got the best deal on January 2, 2007:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT store_key, order_number, date_ordered, vendor_name
   FROM store.store_orders_fact ord JOIN public.vendor_dimension vd ON ord.vendor_key = vd.vendor_key
   WHERE vd.deal_size IN (SELECT MAX(deal_size) FROM public.vendor_dimension) AND date_ordered = &amp;#39;2007-01-02&amp;#39;;
 store_key | order_number | date_ordered |     vendor_name
-----------+--------------+--------------+----------------------
        50 |        99234 | 2007-01-02   | Everything Wholesale
        81 |       200802 | 2007-01-02   | Everything Wholesale
       115 |        13793 | 2007-01-02   | Everything Wholesale
       204 |        41842 | 2007-01-02   | Everything Wholesale
       133 |       169025 | 2007-01-02   | Everything Wholesale
       163 |       208580 | 2007-01-02   | Everything Wholesale
        29 |       154972 | 2007-01-02   | Everything Wholesale
       145 |       236790 | 2007-01-02   | Everything Wholesale
       249 |        54838 | 2007-01-02   | Everything Wholesale
         7 |       161536 | 2007-01-02   | Everything Wholesale
(10 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following SELECT statement queries all data in table &lt;code&gt;t11&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t11 ORDER BY pk;
 pk | col1 | col2 | SKIP_ME_FLAG
----+------+------+--------------
  1 |    2 |    3 | t
  2 |    3 |    4 | t
  3 |    4 |    5 | f
  4 |    5 |    6 | f
  5 |    6 |    7 | t
  6 |      |    8 | f
  7 |    8 |      | t
(7 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following query specifies an &lt;code&gt;IN&lt;/code&gt; predicate, to find all rows in &lt;code&gt;t11&lt;/code&gt; where columns &lt;code&gt;col1&lt;/code&gt; and &lt;code&gt;col2&lt;/code&gt; contain values of &lt;code&gt;(2,3)&lt;/code&gt; or &lt;code&gt;(6,7)&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT * FROM t11 WHERE (col1, col2) IN ((2,3), (6,7)) ORDER BY pk;
 pk | col1 | col2 | SKIP_ME_FLAG
----+------+------+--------------
  1 |    2 |    3 | t
  5 |    6 |    7 | t
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following query uses the &lt;a href=&#34;../../../../en/getting-started/introducing-vmart-example-db/&#34;&gt;VMart&lt;/a&gt; schema to illustrate the use of outer expressions referring to different inner expressions:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT product_description, product_price FROM product_dimension
   WHERE (product_dimension.product_key, product_dimension.product_key) IN
      (SELECT store.store_orders_fact.order_number,
         store.store_orders_fact.quantity_ordered
       FROM store.store_orders_fact);
     product_description     | product_price
-----------------------------+---------------
 Brand #73 wheechair         |           454
 Brand #72 box of candy      |           326
 Brand #71 vanilla ice cream |           270
(3 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: INTERPOLATE</title>
      <link>/en/sql-reference/language-elements/predicates/interpolate/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/predicates/interpolate/</guid>
      <description>
        
        
        &lt;p&gt;Joins two &lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/event-series/&#34; title=&#34;Tables with a time column, most typically a timestamp data type.&#34;&gt;event series&lt;/a&gt; using some ordered attribute. Event series joins let you compare values from two series directly, rather than having to normalize the series to the same measurement interval.&lt;/p&gt;
&lt;p&gt;An event series join is an extension of a regular &lt;a href=&#34;../../../../en/data-analysis/queries/joins/outer-joins/&#34;&gt;outer join&lt;/a&gt;. The difference between expressing a regular outer join and an event series join is the INTERPOLATE predicate, which is used in the ON clause (see &lt;a href=&#34;#Examples&#34;&gt;Examples&lt;/a&gt; below). Instead of padding the non-preserved side with null values when there is no match, the event series join pads the non-preserved side with the previous/next values from the table.&lt;/p&gt;
&lt;p&gt;Interpolated values come from the table that contains the null, not from the other table.Vertica does not guarantee that the output contains no null values. If there is no previous/next value for a mismatched row, that row is padded with nulls.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;expression1&lt;/span&gt; INTERPOLATE { PREVIOUS | NEXT } VALUE &lt;span class=&#34;code-variable&#34;&gt;expression2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;
&lt;em&gt;&lt;code&gt;expression1&lt;/code&gt;&lt;/em&gt;,&lt;em&gt;&lt;code&gt;expression2&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;A &lt;a href=&#34;../../../../en/sql-reference/language-elements/expressions/column-references/&#34;&gt;column reference&lt;/a&gt; from one of the tables specified in the &lt;a href=&#34;../../../../en/sql-reference/statements/select/from-clause/&#34;&gt;FROM clause&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The columns can be of any data type. Because event series are time-based, the type is typically &lt;code&gt;DATE/TIME&lt;/code&gt;or &lt;code&gt;TIMESTAMP&lt;/code&gt;.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;{ PREVIOUS | NEXT } VALUE&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;











&lt;p&gt;Pads the non-preserved side with the previous/next values when there is no match. If previous is called on the first row (or next on the last row), will pad with null values.&lt;/p&gt;
&lt;p&gt;Input rows are sorted in ascending logical order of the join column.&lt;/p&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;
&lt;p&gt;An ORDER BY clause, if used, does not determine the input order but only determines query output order.&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Data is logically partitioned on the table in which it resides, based on other ON clause equality predicates.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Event series join requires that the joined tables are both sorted on columns in equality predicates, in any order, followed by the INTERPOLATED column. If data is already sorted in this order, then an explicit sort is avoided, which can improve query performance. For example, given the following tables:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ask: exchange, stock, ts, pricebid: exchange,
stock, ts, price
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the query that follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ask&lt;/code&gt; is sorted on &lt;code&gt;exchange, stock&lt;/code&gt; (or the reverse), &lt;code&gt;ts&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;bid&lt;/code&gt; is sorted on &lt;code&gt;exchange, stock&lt;/code&gt; (or the reverse), &lt;code&gt;ts&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT ask.price - bid.price, ask.ts, ask.stock, ask.exchange
FROM ask FULL OUTER JOIN bid
   ON ask.stock = bid.stock AND ask.exchange =
   bid.exchange AND ask.ts INTERPOLATE PREVIOUS
   VALUE bid.ts;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;restrictions&#34;&gt;Restrictions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Only one INTERPOLATE expression is allowed per join.&lt;/li&gt;
&lt;li&gt;INTERPOLATE expressions are used only with ANSI SQL-99 syntax (the ON clause), which is already true for full outer joins.&lt;/li&gt;
&lt;li&gt;INTERPOLATE can be used with equality predicates only.&lt;/li&gt;
&lt;li&gt;The AND operator is supported but not the OR and NOT operators.&lt;/li&gt;
&lt;li&gt;Expressions and implicit or explicit casts are not supported, but subqueries are allowed.
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;semantics&#34;&gt;Semantics&lt;/h2&gt;
&lt;p&gt;When you write an event series join in place of normal join, values are evaluated as follows (using the schema in the examples below):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;t&lt;/code&gt; is the outer, preserved table.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;t1&lt;/code&gt; is the inner, non-preserved table.&lt;/li&gt;
&lt;li&gt;For each row in outer table &lt;code&gt;t&lt;/code&gt;, the ON clause predicates are evaluated for each combination of each row in the inner table &lt;code&gt;t1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If the ON clause predicates evaluate to true for any combination of rows, those combination rows are produced at the output.&lt;/li&gt;
&lt;li&gt;If the ON clause is false for all combinations, a single output row is produced with the values of the row from &lt;code&gt;t&lt;/code&gt; along with the columns of &lt;code&gt;t1&lt;/code&gt; chosen from the row in &lt;code&gt;t1&lt;/code&gt; with the greatest &lt;code&gt;t1.y&lt;/code&gt; value such that &lt;code&gt;t1.y &amp;lt; t.x&lt;/code&gt;; If no such row is found, pad with nulls.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;code&gt;t LEFT OUTER JOIN t1&lt;/code&gt; is equivalent to &lt;code&gt;t1 RIGHT OUTER JOIN t&lt;/code&gt;.

&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the case of a full outer join, all values from both tables are preserved.&lt;/p&gt;
&lt;p&gt;&lt;a name=&#34;Examples&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The examples that follow use this simple schema.
&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE t(x TIME);
CREATE TABLE t1(y TIME);
INSERT INTO t VALUES(&amp;#39;12:40:23&amp;#39;);
INSERT INTO t VALUES(&amp;#39;13:40:25&amp;#39;);
INSERT INTO t VALUES(&amp;#39;13:45:00&amp;#39;);
INSERT INTO t VALUES(&amp;#39;14:49:55&amp;#39;);
INSERT INTO t1 VALUES(&amp;#39;12:40:23&amp;#39;);
INSERT INTO t1 VALUES(&amp;#39;14:00:00&amp;#39;);
COMMIT;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;normal-full-outer-join&#34;&gt;Normal full outer join&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t FULL OUTER JOIN t1 ON t.x = t1.y;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Notice the null rows from the non-preserved table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;    x     |    y
----------+----------
 12:40:23 | 12:40:23
 13:40:25 |
 13:45:00 |
 14:49:55 |
          | 14:00:00
(5 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;full-outer-join-with-interpolation&#34;&gt;Full outer join with interpolation&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t FULL OUTER JOIN t1 ON t.x INTERPOLATE PREVIOUS VALUE t1.y;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this case, the rows with no entry point are padded with values from the previous row.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;    x     |    y
----------+----------
 12:40:23 | 12:40:23
 13:40:25 | 12:40:23
 13:45:00 | 12:40:23
 14:49:55 | 12:40:23
 13:40:25 | 14:00:00
(5 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Likewise, interpolate next is also supported:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t FULL OUTER JOIN t1 ON t.x INTERPOLATE NEXT VALUE t1.y;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this case, the rows with no entry point are padded with values from the next row.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;    x     |    y
----------+----------
 12:40:23 | 12:40:23
 13:40:25 | 14:00:00
 13:45:00 | 14:00:00
 14:49:55 |
 14:49:55 | 14:00:00
(5 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;normal-left-outer-join&#34;&gt;Normal left outer join&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t LEFT OUTER JOIN t1 ON t.x = t1.y;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Again, there are nulls in the non-preserved table&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;    x     |    y
----------+----------
 12:40:23 | 12:40:23
 13:40:25 |
 13:45:00 |
 14:49:55 |
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;left-outer-join-with-interpolation&#34;&gt;Left outer join with interpolation&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t LEFT OUTER JOIN t1 ON t.x INTERPOLATE PREVIOUS VALUE t1.y;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Nulls have been padded with interpolated values.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;    x     |    y
----------+----------
 12:40:23 | 12:40:23
 13:40:25 | 12:40:23
 13:45:00 | 12:40:23
 14:49:55 | 14:00:00
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Likewise, interpolate next is also supported:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t LEFT OUTER JOIN t1 ON t.x INTERPOLATE NEXT VALUE t1.y;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Nulls have been padded with interpolated values here as well.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;    x     |    y
----------+----------
 12:40:23 | 12:40:23
 13:40:25 | 14:00:00
 13:45:00 | 14:00:00
 14:49:55 |
 (4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;inner-joins&#34;&gt;Inner joins&lt;/h3&gt;
&lt;p&gt;For inner joins, there is no difference between a regular inner join and an event series inner join. Since null values are eliminated from the result set, there is nothing to interpolate.&lt;/p&gt;
&lt;p&gt;A regular inner join returns only the single matching row at 12:40:23:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t INNER JOIN t1 ON t.x = t1.y;
    x     |    y
----------+----------
 12:40:23 | 12:40:23
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;An event series inner join finds the same single-matching row at 12:40:23:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t INNER JOIN t1 ON t.x INTERPOLATE PREVIOUS VALUE t1.y;
    x     |    y
----------+----------
 12:40:23 | 12:40:23
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/data-analysis/queries/joins/event-series-joins/&#34;&gt;Event series joins&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: LIKE</title>
      <link>/en/sql-reference/language-elements/predicates/like/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/predicates/like/</guid>
      <description>
        
        
        &lt;p&gt;Retrieves rows where a string expression—typically a column—matches the specified pattern or, if qualified by ANY or ALL, set of patterns. The pattern can contain one or more wildcard characters.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;string‑expression&lt;/span&gt; [ NOT ] { LIKE | ILIKE | LIKEB | ILIKEB }
   { &lt;span class=&#34;code-variable&#34;&gt;pattern&lt;/span&gt; | { ANY | ALL } ( &lt;span class=&#34;code-variable&#34;&gt;pattern&lt;/span&gt;,... ) } [ ESCAPE &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;char&lt;/span&gt;&amp;#39; ]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;
&lt;em&gt;&lt;code&gt;string‑expression&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;


String expression, typically a column, to test for instances of the specified &lt;a href=&#34;#pattern-spec&#34;&gt;pattern or patterns&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;NOT&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Returns true if the LIKE predicate returns false and vice-versa, equivalent to:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;NOT &lt;/code&gt;&lt;em&gt;&lt;code&gt;string‑expression&lt;/code&gt;&lt;/em&gt;&lt;code&gt; &lt;/code&gt;&lt;em&gt;&lt;code&gt;like-operator &lt;/code&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;LIKE | ILIKE | LIKEB | ILIKEB&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;







&lt;p&gt;One of the following operators:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;LIKE&lt;/code&gt;: Complies with the SQL standard, case-sensitive, operates on UTF-8 character strings, exact behavior depends on collation parameters such as strength. LIKE is &lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/stable-functions/&#34; title=&#34;See also Immutable (invariant) functions.&#34;&gt;stable&lt;/a&gt; for character strings, but &lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;immutable&lt;/a&gt; for binary strings&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ILIKE&lt;/code&gt;: Same as LIKE but case-insensitive.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;LIKEB&lt;/code&gt;: Performs case-sensitive byte-at-a-time ASCII comparisons, &lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;immutable&lt;/a&gt; for character and binary strings.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ILIKEB&lt;/code&gt;: Same as LIKEB but case-insensitive.&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;span class=&#34;code-variable&#34;&gt;&lt;a name=&#34;pattern-spec&#34;&gt;&lt;/a&gt;pattern&lt;/span&gt;&lt;/td&gt; 

&lt;td &gt;
















&lt;p&gt;A pattern to test against &lt;em&gt;&lt;code&gt;string‑expression&lt;/code&gt;&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39; | { ANY | ALL } ( &lt;/code&gt;&lt;em&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/em&gt;&lt;code&gt;,...)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ANY&lt;/code&gt;/&lt;code&gt;ALL&lt;/code&gt; specify a comma-delimited list of patterns, where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ANY&lt;/code&gt; returns true if any pattern matches, equivalent to logical OR.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ALL&lt;/code&gt; returns true only if all patterns match, equivalent to logical AND.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pattern strings can contain the following wildcard characters&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;_&lt;/code&gt; (underscore): Match any single character.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;%&lt;/code&gt; (percent): Match any string of zero or more characters.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;ESCAPE &lt;/code&gt;&lt;em&gt;&lt;code&gt;char&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;











&lt;p&gt;Specifies an escape character, by default backslash (&lt;code&gt;\&lt;/code&gt;), used to escape reserved characters: wildcard characters (underscore and percent), and the escape character itself.&lt;/p&gt;
&lt;p&gt;This option is enforced only for non-default collations; it is currently unsupported with ANY/ALL pattern matching.&lt;/p&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;
&lt;p&gt;Backslash is not valid for binary data types character. To embed an escape character for binary data types, use &lt;code&gt;ESCAPE&lt;/code&gt; to specify a valid binary character.&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;substitute-symbols&#34;&gt;Substitute symbols&lt;/h2&gt;
&lt;p&gt;You can substitute the following symbols for LIKE and its variants:

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

ESCAPE usage is not valid for these symbols.

&lt;/div&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Symbol&lt;/th&gt; 

&lt;th &gt;
Eqivalent to:&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;~~&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
LIKE&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;~#&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
LIKEB&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;~~*&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
ILIKE&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;~#*&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
ILIKEB&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;!~~&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
NOT LIKE&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;!~#&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
NOT LIKEB&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;!~~*&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
NOT ILIKE&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;!~#*&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
NOT ILIKEB&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h2 id=&#34;pattern-matching&#34;&gt;Pattern matching&lt;/h2&gt;
&lt;p&gt;LIKE and its variants require that the entire string expression match the specified patterns. To match a sequence of characters anywhere within a string, the pattern must start and end with a percent sign.&lt;/p&gt;
&lt;p&gt;LIKE does not ignore trailing white space characters. If the data values to match end with an indeterminate amount of white space, append the wildcard character &lt;code&gt;%&lt;/code&gt; to &lt;em&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&#34;locale-dependencies&#34;&gt;Locale dependencies&lt;/h2&gt;
&lt;p&gt;In the default locale, LIKE and ILIKE handle UTF-8 character-at-a-time, locale-insensitive comparisons. ILIKE handles language-independent case-folding.&lt;/p&gt;
&lt;p&gt;In non-default locales, LIKE and ILIKE perform locale-sensitive string comparisons, including some automatic normalization, using the same algorithm as the &lt;code&gt;=&lt;/code&gt; operator on VARCHAR types.&lt;/p&gt;
&lt;p&gt;ESCAPE expressions evaluate to exactly one octet—or one UTF-8 character for non-default locales.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;h3 id=&#34;basic-pattern-matching&#34;&gt;Basic pattern matching&lt;/h3&gt;
&lt;p&gt;The following query searches for customer names that start with &lt;code&gt;Ever&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT DISTINCT(customer_name) FROM customer_dimension WHERE customer_name LIKE &amp;#39;Ever%&amp;#39;;
 customer_name
---------------
 Evermedia
 Evergen
 Evercom
 Evershop
 Everdata
 Evercorp
 Everstar
 Everhope
 Evertech
 Evercore
 Evercare
(11 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a name=&#34;LIKE_ANY_ALL_Examples&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;like-anyall-usage&#34;&gt;LIKE ANY/ALL usage&lt;/h3&gt;
&lt;p&gt;LIKE operators support the keywords ANY and ALL, which let you specify multiple patterns to test against a string expression. For example, the following query uses case-insensitive ILIKE to find all customer names that contain the strings &lt;code&gt;media&lt;/code&gt; or &lt;code&gt;ever&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT DISTINCT (customer_name) FROM customer_dimension
     WHERE customer_name ILIKE ANY (&amp;#39;%media%&amp;#39;,&amp;#39;%ever%&amp;#39;) ORDER BY customer_name;
 customer_name
---------------
 Amerimedia
 Bettermedia
 Evercare
 Evercom
 Evercore
 Evercorp
 Everdata
 Evergen
 Everhope
 Evermedia
 Evershop
 Everstar
 Evertech
 Foodmedia
 Goldmedia
 Infomedia
 Inimedia
 Intramedia
 Metamedia
 Verimedia
 Virtamedia
(21 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;LIKE ANY usage is equivalent to specifying multiple conditions that are combined with OR:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT DISTINCT (customer_name) FROM customer_dimension
     WHERE customer_name ILIKE &amp;#39;%media%&amp;#39; OR customer_name ILIKE &amp;#39;%ever%&amp;#39; ORDER BY customer_name;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Similarly, LIKE ALL usage is equivalent to specifying multiple conditions that are combined with AND. For example, the following query uses case-insensitive ILIKE to find all customer names that contain the strings &lt;code&gt;media&lt;/code&gt; and &lt;code&gt;ever&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT DISTINCT (customer_name) FROM customer_dimension
     WHERE customer_name ILIKE ALL (&amp;#39;%media%&amp;#39;,&amp;#39;%ever%&amp;#39;) ORDER BY customer_name;
 customer_name
---------------
 Evermedia
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;pattern-matching-in-locales&#34;&gt;Pattern matching in locales&lt;/h3&gt;
&lt;p&gt;The following example illustrates pattern matching in locales.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; \locale default
INFO 2567:  Canonical locale: &amp;#39;en_US&amp;#39;
Standard collation: &amp;#39;LEN_KBINARY&amp;#39;
English (United States)
=&amp;gt; CREATE TABLE src(c1 VARCHAR(100));
=&amp;gt; INSERT INTO src VALUES (U&amp;amp;&amp;#39;\00DF&amp;#39;); --The sharp s (ß)
=&amp;gt; INSERT INTO src VALUES (&amp;#39;ss&amp;#39;);
=&amp;gt; COMMIT;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Querying the &lt;code&gt;src&lt;/code&gt; table in the default locale returns both ss and sharp s.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM src;
 c1
----
 ß
 ss
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following query combines pattern-matching predicates to return the results from column &lt;code&gt;c1&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1, c1 = &amp;#39;ss&amp;#39; AS equality, c1 LIKE &amp;#39;ss&amp;#39;
   AS LIKE, c1 ILIKE &amp;#39;ss&amp;#39; AS ILIKE FROM src;
 c1 | equality | LIKE | ILIKE
----+----------+------+-------
 ß  | f        | f    | f
 ss | t        | t    | t
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The next query specifies unicode format for &lt;code&gt;c1&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT c1, c1 = U&amp;amp;&amp;#39;\00DF&amp;#39; AS equality,
   c1 LIKE U&amp;amp;&amp;#39;\00DF&amp;#39; AS LIKE,
   c1 ILIKE U&amp;amp;&amp;#39;\00DF&amp;#39; AS ILIKE from src;
 c1 | equality | LIKE | ILIKE
----+----------+------+-------
 ß  | t        | t    | t
 ss | f        | f    | f
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now change the locale to German with a strength of 1 (ignore case and accents):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; \locale LDE_S1
INFO 2567:  Canonical locale: &amp;#39;de&amp;#39;
Standard collation: &amp;#39;LDE_S1&amp;#39;
German  Deutsch
=&amp;gt; SELECT c1, c1 = &amp;#39;ss&amp;#39; AS equality,
c1 LIKE &amp;#39;ss&amp;#39; as LIKE, c1 ILIKE &amp;#39;ss&amp;#39; AS ILIKE from src;
 c1 | equality | LIKE | ILIKE
----+----------+------+-------
 ß  | t        | t    | t
 ss | t        | t    | t
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This example illustrates binary data types with pattern-matching predicates:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE t (c BINARY(1));
CREATE TABLE
=&amp;gt; INSERT INTO t VALUES (HEX_TO_BINARY(&amp;#39;0x00&amp;#39;)), (HEX_TO_BINARY(&amp;#39;0xFF&amp;#39;));
 OUTPUT
--------
      2
(1 row)

=&amp;gt; COMMIT;
COMMIT
=&amp;gt; SELECT TO_HEX(c) FROM t;
 TO_HEX
--------
 00
 ff
(2 rows)

=&amp;gt; SELECT * FROM t;
  c
------
 \000
 \377
(2 rows)

=&amp;gt; SELECT c, c = &amp;#39;\000&amp;#39;, c LIKE &amp;#39;\000&amp;#39;, c ILIKE &amp;#39;\000&amp;#39; from t;
  c   | ?column? | ?column? | ?column?
------+----------+----------+----------
 \000 | t        | t        | t
 \377 | f        | f        | f
(2 rows)

=&amp;gt; SELECT c, c = &amp;#39;\377&amp;#39;, c LIKE &amp;#39;\377&amp;#39;, c ILIKE &amp;#39;\377&amp;#39; FROM t;
  c   | ?column? | ?column? | ?column?
------+----------+----------+----------
 \000 | f        | f        | f
 \377 | t        | t        | t
(2 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: NULL</title>
      <link>/en/sql-reference/language-elements/predicates/null/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/predicates/null/</guid>
      <description>
        
        
        &lt;p&gt;Tests for null values.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;value‑expression&lt;/span&gt; IS [ NOT ] NULL
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;
&lt;em&gt;&lt;code&gt;value‑expression&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;


Column name, literal, or function&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Column name:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT date_key FROM date_dimension WHERE date_key IS NOT NULL;
 date_key
----------
        1
      366
     1462
     1097
        2
        3
        6
        7
        8
...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Function:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT MAX(household_id) IS NULL FROM customer_dimension;
 ?column?
----------
 f
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Literal:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#39;a&amp;#39; IS NOT NULL;
 ?column?
----------
 t
(1 row)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
  </channel>
</rss>
