CREATE TABLE statement
Create a FeatureBase table with the specified columns and data types.
BNF diagrams
COLUMN_LIST
Data types
Table_options
Syntax
CREATE TABLE
[IF NOT EXISTS]
<table_name>
(COLUMN_LIST)
[WITH COMMENT 'comment'];
Arguments
Argument | Description | Required? | Additional information |
---|---|---|---|
<table_name> | String literal table identifier | Yes | Naming standards |
IF NOT EXISTS | Stop statement execution if a table of the same name already exists | Optional | |
COLUMN_LIST | List of column names, data types and optional constraints with leading _id column that can be ID or STRING data type | Yes | * _id column * Naming standards * ID data type * STRING data type |
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 _id
column in each table represents the primary key and supports two data types:
Data type | Description | Example | Advantage | Disadvantage |
---|---|---|---|---|
ID data type | One or more contiguous blocks of positive integers | 7,8,9,10,11,12,...20,21,22,23,... | Faster queries | Warning: performance and storage are adversely affected if values are non-contiguous |
String data type | String literal values can be supplied in any order if used as primary key | “a23”, “s93kk”, “h82k”, “2023-02-10”,… | Automatically mapped to blocks of contiguous integers | Higher storage and performance costs |
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 |