CREATE TABLE statement
Create a FeatureBase table with the specified columns and data types.
BNF diagrams
COLUMN_LIST
Type_name
Column_constraint
Table_options
Syntax
CREATE TABLE
[IF NOT EXISTS]
table_name
(COLUMN_LIST)
[with comment 'comment'];
Arguments
Argument | Description | Required? | Additional information |
---|---|---|---|
table_name | Valid table name | Yes | Naming standards |
IF NOT EXISTS | Optional argument that stops statement execution if a table of the same name already exists | No | |
COLUMN_LIST | List of column names, data types and optional constraints. The list must include the _id column | Yes | * _id column * Naming standards * Data types |
with comment | Optional string literal that describes the table | No |
Additional information
Naming standards
FeatureBase identifiers (including object names such as databases, tables and columns) start with a lower-case alphabetic character and can include:
- lower-case alphabetic characters
- numbers 0-9
-
dash
-
and underscore_
characters. -
table names can be up to 230 characters in length
- column names can be up to 64 characters in length
_id
column
The table ID column (_id
) is used as the table primary key and must uniquely represent a record in your table.
UI Type | SQL data type | Data source table unique key |
---|---|---|
Number | id | Positive integer |
String | string | String key or a combination of columns used to create a unique key |
CREATE TABLE
examples
Statement | Data types | Table options | Relates to |
---|---|---|---|
CREATE TABLE cosvec-target | * ID * STRING * VECTOR | INSERT INTO cosvec-target | |
CREATE TABLE csv-target | * INT * STRING | BULK INSERT csv-target | |
CREATE TABLE ndjson-target | * BOOL * ID * STRING * TIMESTAMP | * IF NOT EXISTS * WITH COMMENT | BULK INSERT ndjson-target |
CREATE TABLE orc-target | * BOOL * ID * INT * STRING | * IF NOT EXISTS * WITH COMMENT | BULK INSERT orc-target |
CREATE TABLE parquet-target | * ID * INT * DECIMAL | BULK INSERT parquet-target | |
CREATE TABLE tuple-set-target | * IDSET * IDSETQ * INT * STRING * STRINGSET * STRINGSETQ | BULK INSERT tuple-set-target | |
CREATE TABLE tan-target | * ID * STRINGSET | INSERT INTO tan-target |