Column-Definition
Specifies the name, data type, and constraints to be applied to a column.
Syntax
column-name data-type [ column‑constraint ][...] [ ENCODING encoding-type ] [ ACCESSRANK integer ]
Parameters
column-name
|
The name of a column to be created or added. |
data-type
|
A Vertica-supported data type. When specifying the maximum column width in a CREATE TABLE statement, use the width in bytes (octets) for any of the string types. Each UTF-8 character might require four bytes, but European languages generally require a little over one byte per character, while Oriental languages generally require a little under three bytes per character. |
column‑constraint
|
A constraint type that Vertica supports—for example, NOT NULL or UNIQUE. For general information, see Constraints. |
ENCODING encoding-type
|
The column encoding type, by default set to AUTO. |
ACCESSRANK integer
|
Overrides the default access rank for a column. Use this parameter to increase or decrease the speed at which Vertica accesses a column. For more information, see Overriding Default Column Ranking. |
Examples
The following example creates a table named Employee_Dimension
and its associated superprojection in the public
schema. The Employee_key
column is designated as a primary key, and RLE encoding is specified for the Employee_gender
column definition:
=> CREATE TABLE public.Employee_Dimension ( Employee_key integer PRIMARY KEY NOT NULL, Employee_gender varchar(8) ENCODING RLE, Courtesy_title varchar(8), Employee_first_name varchar(64), Employee_middle_initial varchar(8), Employee_last_name varchar(64) );