Default a Column’s Value
Jim_Knicely
- Select Field - Administrator
You can specify a table column's default value using a DEFAULT expression. Vertica evaluates the DEFAULT expression and sets the column on load operations, if the operation omits a value for the column.
Examples:
dbadmin=> CREATE TABLE a (b INT, c TIMESTAMP DEFAULT sysdate); CREATE TABLE dbadmin=> INSERT INTO a (b) SELECT 1; OUTPUT -------- 1 (1 row) dbadmin=> SELECT * FROM a; b | c ---+---------------------------- 1 | 2018-10-29 03:42:33.793011 (1 row)
Helpful Links:
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/Statements/column-constraint.htm
Have fun!
0