Skip to main content Link Menu Expand (external link) Document Search Copy Copied

INSERT statement

INSERT or REPLACE multiple rows of data into existing columns in a FeatureBase table.

BNF diagrams

expr

column_list

expr

Run SHOW TABLE <tablename> to learn the structure of a destination table

value_list

expr

Syntax

INSERT INTO
  <table_name> [(<column_list>)]
  VALUES
      {(<value_list>),...};

Arguments

Argument Description Required? Additional information
<table-name> Target table name Yes  
<column_list> List of columns which must include the _id column Optional When omitted, FeatureBase assumes <value-list> will be inserted into existing <column-list>
<value-list> The list of constants and/or functions joined by operators, or a subquery to be inserted into the column. Yes Value list additional

Additional information

Limitations

The INSERT statement has the following limitations:

  • <value-list> must match <column-list>
  • Rows with duplicate _id are overwritten
  • NULL values in duplicate _id rows are ignored

Value assignment

Data type Assignment Additional information
All NULL (case insensitive)
''(String)
Cannot be assigned for SETQ value list
String '<value>' Empty string can also be represented as NULL
SET [<value>,...]  
SETQ {<timestamp>,[<value>,...]}  
VECTOR(n) {<value>,...} n values must be inserted

Use semicolons to separate values in a CSV data source intended for SET and SETQ columns. e.g., <previous-value>,<value>;...,<next-value>

Use semicolons to separate values in a CSV data source intended for VECTOR columns: e.g., <previous-value>,<value>;...,<next-value>

UPDATE/REPLACE behavior

FeatureBase ingest uses UPSERT behavior, but the ways a value updates varies depending on the data type.

Literal Value Target Data Type Resultant Additional information
Value of same type All unless explicitly listed Replace existing value with literal value  
string literal stringset Add new value to existing set of values if it does not exist  
string literal stringsetq Add new value to existing set of values if it does not exist or update associated timestamp and views if value does exist  
integer literal idset Add new value to existing set of values if it does not exist  
integer literal idsetq Add new value to existing set of values if it does not exist or update associated timestamp and views if value does exist  
,NULL, All unless explicitly listed set to NULL  
,[], stringset
idset
stringsetq
idsetq
Keep existing set of values or set to [] (empty set) if existing set is NULL  

Examples

INSERT examples

Further information