A column definition specifies the name, data type, and constraints to be applied to a column.
Syntax
column-name data-type [ column-constraint [ ... ] ]
Adds a referential integrity constraint to the metadata of a column. See Adding Join Constraints in the Database Administrator's Guide.
Referential integrity in Vertica consists of a set of constraints (logical schema objects) that define primary key and foreign key columns. In a star schema or snowflake schema:
Syntax
[ CONSTRAINT constraint-name ]
{ [ NOT ] NULL
| PRIMARY KEY
| REFERENCES table-name [ ( column-name ) ]
[ DEFAULT constant ]
}
Semantics
CONSTRAINT constraint-name |
optionally assigns a name to the constraint. Vertica recommends that you name all constraints. |
NULL |
(default) specifies that the column is allowed to contain null values. |
NOT NULL |
specifies that the column must receive a value during INSERT and UPDATE operations. If no DEFAULT value is specified and no value is provided, the INSERT or UPDATE statement returns an error because no default value exists. |
PRIMARY KEY |
adds a Referential integrity in Vertica consists of a set of constraints (logical schema objects) that define primary key and foreign key columns. In a star schema or snowflake schema:
|
REFERENCES |
adds a referential integrity constraint defining the column as a foreign key. If column is omitted, the default is the primary key of table. |
table-name |
specifies the table to which the REFERENCES constraint applies. |
column-name |
specifies the column to which the REFERENCES constraint applies. If column is omitted, the default is the primary key of table-name. |
DEFAULT constant |
specifies a constant to be used by default in any INSERT operation that does not specify a value for the column. The data type of the constant must match the data type of the column. If no default value is specified, the default is null. |
Notes
Semantics
column-name |
specifies the name of a column to be created or added. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data-type |
specifies one of the following data types: Vertica provides the standard SQL type BOOLEAN, which has two states: true and false. The third state in SQL boolean logic is unknown, which is represented by the NULL value. Syntax BOOLEAN Semantics Valid literal data values for input are:
Notes
The CHARACTER type is a fixed-length, blank padded string. Syntax [ CHARACTER | CHAR ] (n) Semantics
Notes
The CHARACTER VARYING type is a variable-length string. Syntax [ CHARACTER VARYING | VARCHAR ] (n) Semantics
Notes
Vertica supports the full set of SQL date and time types. In most cases, a combination of Notes
Vertica supports the numeric data type DOUBLE PRECISION, which is the IEEE-754 8-byte floating point type along with most of the usual floating point operations. Syntax [ DOUBLE PRECISION | FLOAT | FLOAT8 ] Semantics On a machine whose floating-point arithmetic does not follow IEEE 754, these values probably do not work as expected. Double precision is an inexact, variable-precision numeric type. In other words, some values cannot be represented exactly and are stored as approximations. Thus, input and output operations involving double precision may show slight discrepancies.
Values COPY accepts floating-point data in the following format:
A decimal number consists of a non-empty sequence of decimal digits possibly containing a radix character (decimal point, locale dependent, usually "."), optionally followed by a decimal exponent. A decimal exponent consists of an "E" or "e", followed by an optional plus or minus sign, followed by a non-empty sequence of decimal digits, and indicates multiplication by a power of 10. A hexadecimal number consists of a "0x" or "0X" followed by a non-empty sequence of hexadecimal digits possibly containing a radix character, optionally followed by a binary exponent. A binary exponent consists of a "P" or "p", followed by an optional plus or minus sign, followed by a non-empty sequence of decimal digits, and indicates multiplication by a power of 2. At least one of radix character and binary exponent must be present. An infinity is either "INF" or "INFINITY", disregarding case. A NAN (Not A Number) is "NAN" (disregarding case) optionally followed by a sequence of characters enclosed in parentheses. The character string specifies the value of NAN in an implementation-dependent manner. (The Vertica internal representation of NAN is 0xfff8000000000000LL on x86 machines.) When writing infinity or NAN values as constants in a SQL statement, enclose them in single quotes. For example: UPDATE table SET x = 'Infinity'
The load file format of a null value is user defined, as described in the COPY command. The Vertica internal representation of a null value is 0x7fffffffffffffffLL. The interactive format is controlled by the vsql is the Vertica implementation of psql, a character-based, interactive, front-end that is part of PostgreSQL and used by other database management systems. It allows you to type in SQL statements and see the results. It also provides a number of meta-commands and various shell-like features to facilitate writing scripts and automating a wide variety of tasks. \pset null '(null)' The default option is not to print anything. Rules
To search for NaN column values, use the following predicate: ... WHERE column != column This is necessary because Sort Order (Ascending)
Notes
Vertica supports the numeric data type INTEGER, a signed eight-byte (64-bit) data type. Syntax [ INTEGER | INT | BIGINT ] Semantics The difference between integer and bigint is in the way that vsql is the Vertica implementation of psql, a character-based, interactive, front-end that is part of PostgreSQL and used by other database management systems. It allows you to type in SQL statements and see the results. It also provides a number of meta-commands and various shell-like features to facilitate writing scripts and automating a wide variety of tasks. Notes The JDBC type INTEGER is 4-bytes, and is not supported by Vertica; use BIGINT instead.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
column-constraint |
specifies a Adds a Referential integrity in Vertica consists of a set of constraints (logical schema objects) that define primary key and foreign key columns. In a star schema or snowflake schema:
Syntax [ CONSTRAINT constraint-name ] { [ NOT ] NULL | PRIMARY KEY | REFERENCES table-name [ ( column-name ) ] [ DEFAULT constant ] } Semantics
Notes
|