FeatureBase SQL-guide examples
Supported SQL statements, data-types, expressions, functions and operators are demonstrated in the following examples.
Table of contents
Before you begin
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 |
–>
INSERT
examples
Statement | Target table |
---|---|
INSERT INTO cosvec-target | cosvec-target |
INSERT INTO tan-target | tan-target |
BULK INSERT
examples
The following SQL examples demonstrate BULK INSERT using different clauses and data sources.
Statement | Target table | FROM clause | TRANSFORM clause | WITH clause |
---|---|---|---|---|
BULK INSERT using CSV data source | csv-target | URL | * BATCHSIZE * FORMAT * INPUT * HEADER_ROW | |
BULK INSERT using ndJSON data source | ndjson-target | URL | Includes CAST function | * BATCHSIZE * FORMAT * INPUT * ALLOW_MISSING_VALUES |
BULK INSERT using ORC data source | orc-target | URL | * FORMAT * INPUT | |
BULK INSERT using Apache Parquet data source | parquet-target | URL | * FORMAT * INPUT | |
BULK INSERT using inline CSV | tuple-set-target | Inline CSV | Combines column values using TUPLE function | * FORMAT * INPUT |
SELECT
examples
These examples demonstrate SELECT statements that use different clauses, expressions, functions and operators.
Statement | Target table | SELECT clauses | Expressions | Functions | Operators |
---|---|---|---|---|---|
SELECT FROM cosvec-target | cosvec-target | COSINE DISTANCE | |||
SELECT FROM csv-target | csv-target | * COUNT() * DISTINCT | |||
SELECT FROM ndjson-target | parquet-target | * WHERE * LIKE * ORDER BY | |||
SELECT FROM orc-target | orc-target | ||||
SELECT FROM parquet-target | parquet-target | * TOP() * WHERE | BETWEEN | ||
SELECT FROM tan-target | tan-target | TANIMOTO_COEFFICIENT() | |||
SELECT FROM tuple-set-target | parquet-target | DATETIMENAME() |