<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Vertica Documentation – Expressions</title>
    <link>/en/sql-reference/language-elements/expressions/</link>
    <description>Recent content in Expressions on Vertica Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/language-elements/expressions/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: Aggregate expressions</title>
      <link>/en/sql-reference/language-elements/expressions/aggregate-expressions/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/expressions/aggregate-expressions/</guid>
      <description>
        
        
        &lt;p&gt;An aggregate expression applies an aggregate function across the rows or groups of rows selected by a query.&lt;/p&gt;
&lt;p&gt;An aggregate expression only can appear in the select list or &lt;code&gt;HAVING&lt;/code&gt; clause of a &lt;code&gt;SELECT&lt;/code&gt; statement. It is invalid in other clauses such as &lt;code&gt;WHERE&lt;/code&gt;, because those clauses are evaluated before the results of aggregates are formed.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;p&gt;An aggregate expression has the following format:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;&lt;span class=&#34;code-variable&#34;&gt;&lt;a href=&#34;../../../../en/sql-reference/functions/aggregate-functions/&#34;&gt;aggregate‑function&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; ( [ * ] [ ALL | DISTINCT ] &lt;span class=&#34;code-variable&#34;&gt;expression&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;span class=&#34;code-variable&#34;&gt;&lt;a href=&#34;../../../../en/sql-reference/functions/aggregate-functions/&#34;&gt;aggregate‑function&lt;/a&gt;&lt;/span&gt;&lt;/td&gt; 

&lt;td &gt;
A Vertica function that aggregates data over groups of rows from a query result set.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;ALL | DISTINCT&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;






&lt;p&gt;Specifies which input rows to process:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ALL&lt;/code&gt; (default): Invokes &lt;em&gt;&lt;code&gt;aggregate‑function&lt;/code&gt;&lt;/em&gt; across all input rows where &lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt; evaluates to a non-null value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;DISTINCT&lt;/code&gt;: Invokes &lt;em&gt;&lt;code&gt;aggregate‑function&lt;/code&gt;&lt;/em&gt; across all input rows where &lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt; evaluates to a unique non-null value.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

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

&lt;td &gt;
A value expression that does not itself contain an aggregate expression.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The AVG aggregate function returns the average income from the customer_dimension table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT AVG(annual_income) FROM customer_dimension;
 AVG
--------------
 2104270.6485
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following example shows how to use the COUNT aggregate function with the DISTINCT keyword to return all distinct values of evaluating the expression x+y for all inventory_fact records.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT COUNT (DISTINCT date_key + product_key) FROM inventory_fact;
COUNT
-------
21560
(1 row)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: CASE expressions</title>
      <link>/en/sql-reference/language-elements/expressions/case-expressions/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/expressions/case-expressions/</guid>
      <description>
        
        
        &lt;p&gt;The &lt;code&gt;CASE&lt;/code&gt; expression is a generic conditional expression that can be used wherever an expression is valid. It is similar to &lt;code&gt;CASE&lt;/code&gt; and &lt;code&gt;IF/THEN/ELSE&lt;/code&gt; statements in other languages.&lt;/p&gt;
&lt;h2 id=&#34;syntax-form-1&#34;&gt;Syntax (form 1)&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CASE
  WHEN &lt;span class=&#34;code-variable&#34;&gt;condition&lt;/span&gt; THEN &lt;span class=&#34;code-variable&#34;&gt;result&lt;/span&gt;
  [ WHEN &lt;span class=&#34;code-variable&#34;&gt;condition&lt;/span&gt; THEN &lt;span class=&#34;code-variable&#34;&gt;result&lt;/span&gt; ]
  ...
  [ ELSE &lt;span class=&#34;code-variable&#34;&gt;result&lt;/span&gt; ]
END
&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;code&gt;condition&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


An expression that returns a Boolean (true/false) result. If the result is false, subsequent &lt;code&gt;WHEN&lt;/code&gt; clauses are evaluated in the same way.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

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

&lt;td &gt;


Specifies the value to return when the associated &lt;em&gt;&lt;code&gt;condition&lt;/code&gt;&lt;/em&gt; is true.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;ELSE &lt;/code&gt;&lt;em&gt;&lt;code&gt;result&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;


If no &lt;em&gt;&lt;code&gt;condition&lt;/code&gt;&lt;/em&gt; is true then the value of the &lt;code&gt;CASE&lt;/code&gt; expression is the result in the &lt;code&gt;ELSE&lt;/code&gt; clause. If the &lt;code&gt;ELSE&lt;/code&gt; clause is omitted and no condition matches, the result is NULL.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;syntax-form-2&#34;&gt;Syntax (form 2)&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CASE &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt;
 WHEN &lt;span class=&#34;code-variable&#34;&gt;value&lt;/span&gt; THEN &lt;span class=&#34;code-variable&#34;&gt;result&lt;/span&gt;
 [ WHEN &lt;span class=&#34;code-variable&#34;&gt;value&lt;/span&gt; THEN &lt;span class=&#34;code-variable&#34;&gt;result&lt;/span&gt; ]
 ...
 [ ELSE &lt;span class=&#34;code-variable&#34;&gt;result&lt;/span&gt; ]
END
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters-1&#34;&gt;Parameters&lt;/h2&gt;

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



&lt;tr&gt; 

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

&lt;td &gt;


An expression that is evaluated and compared to all the &lt;code&gt;value&lt;/code&gt; specifications in &lt;code&gt;WHEN&lt;/code&gt; clauses until one is found that is equal.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

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

&lt;td &gt;


Specifies a value to compare to the &lt;code&gt;expression&lt;/code&gt;.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

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

&lt;td &gt;


Specifies the value to return when the &lt;code&gt;expression&lt;/code&gt; is equal to the specified &lt;code&gt;value&lt;/code&gt;.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;ELSE &lt;/code&gt;&lt;em&gt;&lt;code&gt;result&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;


Specifies the value to return when the &lt;code&gt;expression&lt;/code&gt; is not equal to any &lt;code&gt;value&lt;/code&gt;; if no &lt;code&gt;ELSE&lt;/code&gt; clause is specified, the value returned is null.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;p&gt;The data types of all result expressions must be convertible to a single output type.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following examples show two uses of the &lt;code&gt;CASE&lt;/code&gt; statement.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM test;
 a
---
 1
 2
 3
=&amp;gt; SELECT a,
     CASE WHEN a=1 THEN &amp;#39;one&amp;#39;
          WHEN a=2 THEN &amp;#39;two&amp;#39;
          ELSE &amp;#39;other&amp;#39;
     END
   FROM test;
 a | case
---+-------
 1 | one
 2 | two
 3 | other
=&amp;gt; SELECT a,
     CASE a WHEN 1 THEN &amp;#39;one&amp;#39;
            WHEN 2 THEN &amp;#39;two&amp;#39;
            ELSE &amp;#39;other&amp;#39;
     END
   FROM test;
 a | case
---+-------
 1 | one
 2 | two
 3 | other
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;special-example&#34;&gt;Special example&lt;/h2&gt;
&lt;p&gt;A &lt;code&gt;CASE&lt;/code&gt; expression does not evaluate subexpressions that are not needed to determine the result. You can use this behavior to avoid division-by-zero errors:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT x FROM T1 WHERE
      CASE WHEN x &amp;lt;&amp;gt; 0 THEN y/x &amp;gt; 1.5
      ELSE false
    END;
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Column references</title>
      <link>/en/sql-reference/language-elements/expressions/column-references/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/expressions/column-references/</guid>
      <description>
        
        
        &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;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema.&lt;/span&gt;]&lt;span class=&#34;code-variable&#34;&gt;table-name&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;column-name&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;schema&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;



Database and &lt;a href=&#34;../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;em&gt;&lt;code&gt;table‑name &lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;






&lt;p&gt;One of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Name of a table&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Table alias defined in the query&#39;s &lt;code&gt;FROM&lt;/code&gt; clause&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

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

&lt;td &gt;


A column name that is unique among all queried tables.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;restrictions&#34;&gt;Restrictions&lt;/h2&gt;
&lt;p&gt;A column reference cannot contain any spaces.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Comments</title>
      <link>/en/sql-reference/language-elements/expressions/comments/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/expressions/comments/</guid>
      <description>
        
        
        &lt;p&gt;A comment is an arbitrary sequence of characters beginning with two consecutive hyphen characters and extending to the end of the line. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;   -- This is a standard SQL comment
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A comment is removed from the input stream before further syntax analysis and is effectively replaced by white space.&lt;/p&gt;
&lt;p&gt;Alternatively, C-style block comments can be used where the comment begins with &lt;code&gt;/*&lt;/code&gt; and extends to the matching occurrence of &lt;code&gt;*/&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;   /* multiline comment
    * with nesting: /* nested block comment */
    */
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;These block comments nest, as specified in the SQL standard. Unlike C, you can comment out larger blocks of code that might contain existing block comments.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Date/time expressions</title>
      <link>/en/sql-reference/language-elements/expressions/datetime-expressions/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/expressions/datetime-expressions/</guid>
      <description>
        
        
        &lt;p&gt;Vertica uses an internal heuristic parser for all date/time input support. Dates and times are input as strings, and are broken up into distinct fields with a preliminary determination of what kind of information might be in the field. Each field is interpreted and either assigned a numeric value, ignored, or rejected. The parser contains internal lookup tables for all textual fields, including months, days of the week, and time zones.&lt;/p&gt;
&lt;p&gt;Vertica parses date/time type inputs as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Break the input string into tokens and categorize each token as a string, time, time zone, or number.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Numeric token contains:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;colon (:) — Parse as a time string, include all subsequent digits and colons.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;dash (-), slash (/), or two or more dots (.) — Parse as a date string which might have a text month.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Numeric only — Parse as a single field or an ISO 8601 concatenated date (19990113 for January 13, 1999) or time (141516 for 14:15:16).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Token starts with a plus (+) or minus (–): Parse as a time zone or a special field.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Token is a text string: match up with possible strings.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Perform a binary-search table lookup for the token as either a special string (for example, today), day (for example, Thursday), month (for example, January), or noise word (for example, at, on).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set field values and bit mask for fields. For example, set year, month, day for today, and additionally hour, minute, second for now.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If not found, do a similar binary-search table lookup to match the token with a time zone.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If still not found, throw an error.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Token is a number or number field:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If eight or six digits, and if no other date fields were previously read, interpret as a &amp;quot;concatenated date&amp;quot; (19990118 or 990118). The interpretation is &lt;code&gt;YYYYMMDD&lt;/code&gt; or &lt;code&gt;YYMMDD&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If token is three digits and a year was already read, interpret as day of year.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If four or six digits and a year was already read, interpret as a time (&lt;code&gt;HHMM&lt;/code&gt; or &lt;code&gt;HHMMSS&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If three or more digits and no date fields were found yet, interpret as a year (this forces yy-mm-dd ordering of the remaining date fields).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Otherwise the date field ordering is assumed to follow the &lt;code&gt;DateStyle&lt;/code&gt; setting: mm-dd-yy, dd-mm-yy, or yy-mm-dd. Throw an error if a month or day field is found to be out of range.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If BC is specified: negate the year and add one for internal storage. (In the Vertica implementation, 1 BC = year zero.)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If BC is not specified, and year field is two digits in length: adjust the year to four digits. If field is less than 70, add 2000, otherwise add 1900.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

Gregorian years AD 1–99 can be entered as 4 digits with leading zeros— for example, 0099 = AD 99.

&lt;/div&gt;
&lt;h2 id=&#34;month-day-year-ordering&#34;&gt;Month day year ordering&lt;/h2&gt;
&lt;p&gt;For some formats, ordering of month, day, and year in date input is ambiguous and there is support for specifying the expected ordering of these fields.&lt;/p&gt;
&lt;h2 id=&#34;special-datetime-values&#34;&gt;Special date/time values&lt;/h2&gt;
&lt;p&gt;Vertica supports several special date/time values for convenience, as shown below. All of these values need to be written in single quotes when used as constants in SQL statements.&lt;/p&gt;
&lt;p&gt;The values &lt;code&gt;INFINITY&lt;/code&gt; and &lt;code&gt;-INFINITY&lt;/code&gt; are specially represented inside the system and are displayed the same way. The others are simply notational shorthands that are converted to ordinary date/time values when read. (In particular, &lt;code&gt;NOW&lt;/code&gt; and related strings are converted to a specific time value as soon as they are read.)

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



&lt;tr&gt; 

&lt;th &gt;
String&lt;/th&gt; 

&lt;th &gt;
Valid Data Types&lt;/th&gt; 

&lt;th &gt;
Description&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;epoch&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;



&lt;code&gt;&lt;code&gt;DATE&lt;/code&gt;, &lt;code&gt;TIMESTAMP&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


1970-01-01 00:00:00+00 (UNIX SYSTEM TIME ZERO)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;INFINITY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


&lt;code&gt;TIMESTAMP&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Later than all other time stamps&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;-INFINITY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


&lt;code&gt;TIMESTAMP&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Earlier than all other time stamps&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;NOW&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;



&lt;code&gt;&lt;code&gt;DATE&lt;/code&gt;, &lt;code&gt;TIME&lt;/code&gt;, &lt;code&gt;TIMESTAMP&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Current transaction&#39;s start time&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;NOW&lt;/code&gt; is not the same as the &lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/now-datetime/&#34;&gt;NOW&lt;/a&gt; function.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;TODAY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;



&lt;code&gt;&lt;code&gt;DATE&lt;/code&gt;, &lt;code&gt;TIMESTAMP&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Midnight today&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;TOMORROW&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;



&lt;code&gt;&lt;code&gt;DATE&lt;/code&gt;, &lt;code&gt;TIMESTAMP&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Midnight tomorrow&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;YESTERDAY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;



&lt;code&gt;&lt;code&gt;DATE&lt;/code&gt;, &lt;code&gt;TIMESTAMP&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Midnight yesterday&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;ALLBALLS&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


&lt;code&gt;TIME&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


00:00:00.00 UTC&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;The following SQL-compatible functions can also be used to obtain the current time value for the corresponding data type:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/current-date/&#34;&gt;CURRENT_DATE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/current-time/&#34;&gt;CURRENT_TIME&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/current-timestamp/&#34;&gt;CURRENT_TIMESTAMP&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/localtime/&#34;&gt;LOCALTIME&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/localtimestamp/&#34;&gt;LOCALTIMESTAMP&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The latter four accept an optional precision specification. (See &lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/&#34;&gt;Date/time functions&lt;/a&gt;.) However, these functions are SQL functions and are not recognized as data input strings.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: NULL value</title>
      <link>/en/sql-reference/language-elements/expressions/null-value/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/expressions/null-value/</guid>
      <description>
        
        
        &lt;p&gt;NULL is a reserved keyword used to indicate that a data value is unknown. It is the ASCII abbreviation for NULL characters (&lt;code&gt;\0&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&#34;usage-in-expressions&#34;&gt;Usage in expressions&lt;/h2&gt;
&lt;p&gt;Vertica does not treat an empty string as a NULL value. An expression must specify NULL to indicate that a column value is unknown.&lt;/p&gt;
&lt;p&gt;The following considerations apply to using NULL in expressions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;NULL is not greater than, less than, equal to, or not equal to any other expression. Use the &lt;a href=&#34;../../../../en/sql-reference/language-elements/predicates/boolean/&#34;&gt;Boolean&lt;/a&gt; to determine whether an expression value is NULL.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can write queries with expressions that contain the &lt;code&gt;&amp;lt;=&amp;gt;&lt;/code&gt; operator for &lt;code&gt;NULL=NULL&lt;/code&gt; joins. See &lt;a href=&#34;../../../../en/data-analysis/queries/joins/inner-joins/equi-joins-and-non-equi-joins/&#34;&gt;Equi-joins and non equi-joins&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Vertica accepts NULL characters (&lt;code&gt;&#39;\0&#39;&lt;/code&gt;) in constant strings and does not remove null characters from VARCHAR fields on input or output.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;projection-ordering-of-null-data&#34;&gt;Projection ordering of NULL data&lt;/h2&gt;
&lt;p&gt;Vertica sorts NULL values in projection columns as follows:

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



&lt;tr&gt; 

&lt;th &gt;
Column data type&lt;/th&gt; 

&lt;th &gt;
NULL values placed at...&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;a href=&#34;../../../../en/sql-reference/data-types/numeric-data-types/numeric/&#34;&gt;NUMERIC&lt;/a&gt;  &lt;a href=&#34;../../../../en/sql-reference/data-types/numeric-data-types/integer/&#34;&gt;INTEGER&lt;/a&gt;  &lt;a href=&#34;../../../../en/sql-reference/data-types/datetime-data-types/date/&#34;&gt;DATE&lt;/a&gt;  &lt;a href=&#34;../../../../en/sql-reference/data-types/datetime-data-types/timetimetz/&#34;&gt;TIME&lt;/a&gt;  &lt;a href=&#34;../../../../en/sql-reference/data-types/datetime-data-types/timestamptimestamptz/&#34;&gt;TIMESTAMP&lt;/a&gt;  &lt;a href=&#34;../../../../en/sql-reference/data-types/datetime-data-types/interval/&#34;&gt;INTERVAL&lt;/a&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Beginning of sorted column (&lt;code&gt;NULLS FIRST&lt;/code&gt;)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;a href=&#34;../../../../en/sql-reference/data-types/numeric-data-types/double-precision-float/&#34;&gt;FLOAT&lt;/a&gt;  &lt;a href=&#34;../../../../en/sql-reference/data-types/character-data-types-char-and-varchar/&#34;&gt;STRING&lt;/a&gt;  &lt;a href=&#34;../../../../en/sql-reference/data-types/boolean-data-type/&#34;&gt;BOOLEAN&lt;/a&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
End of sorted column (&lt;code&gt;NULLS LAST&lt;/code&gt;)&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/null-handling-functions/&#34;&gt;NULL-handling functions&lt;/a&gt;

      </description>
    </item>
    
  </channel>
</rss>
