SQL grammar for CREATE EXTERNAL TABLE command
This topic provides an explanation of the SQL grammar that is used for the CREATE EXTERNAL TABLE command.
[INSERT INTO <normal-table>] SELECT <col-list>
FROM EXTERNAL [name] '<data-file>' [USING '(' <Load-options>')']
CREATE EXTERNAL TABLE <ext-table-name><External-table-shape> (<External-table-shape>
| SAMEAS <tablename>) USING '(' <Load-options> ')'
CREATE EXTERNAL TABLE [name] 'file path' [USING 'C' load-options ')' AS SELECT-statement
Load-options: Load-option
| Load-option Load-options // space separated list of USING clause options
Load-option: FORMAT TEXT | INTERNAL | FIXED
| RECORDLENGTH <n>| Length-ref-expr
| RECORDDELIM <string-literal-max-8-bytes >
| LAYOUT ( Zone-definitions )
…..
Zone-definitions: Zone-def
| Zone-def ',' Zone-definitions // comma-separated lists of zone definitions
Zone-def: [Zone-use-type] [Zone-name] [Zone-type] [Zone-style] [Zone-len] [Nullness]
Zone-use-type: REF | FILLER
Zone-name: Identifier
Zone-type: CHAR| VARCHAR
| NCHAR| NVARCHAR
| BOOL
| INT1 | INT2 | INT4 | INT8 | INT
| UINT1 | UINT2 | UINT4 | UINT8 | UINT
| NUMERIC
| FLOATING| DOUBLE
| DATE | TIME | TIMESTAMP | TIMETZ
Zone-style: INTERNAL
| DECIMAL ['decimal-delim']
| FLOATING | SCIENTIFC ['decimal-delim']
| Date-format
| Time-format
| Date-format Time-format
Date-format:
| DateStyle ['date-delim']
| DATE DELIM 'date-delim'
Time-format:
| TimeStyle ['time-delim'] ['decimal-delim']
| TIME DELIM 'time-delim' DecimalDelim 'decimal-delim'
Date-style: YMD| DMY | MDY |.. // all date styles
Time-style: 12HOUR | 24HOUR
Zone-len: BYTES <n> | <Length-ref-expr>
| CHARACTERS <n> | <Length-ref-expr>
Zone-ref: External-ref
| Isolated-ref
| Internal-ref
External-ref: &[n] // 1 based absolute position of zones, 0,
negative values for relative positions backwards
Isolated-ref: &&[n] // 1 based absolute position of zones 0,
negative values for relative positions backwards
Internal-ref: @[n] // 1 based absolute position of zones, 0,
negative values for relative positions backwards
Length-ref-expr: Internal-ref [ Operator <n> ]
Operator: + | -