CREATE a Standalone Collection
- Capella Columnar
- reference
This topic describes how you use the CREATE
statement to create a standalone collection in Capella Columnar.
To create a standalone collection you use CREATE COLLECTION syntax that does not include either the EXTERNAL
keyword or an ON
clause.
Syntax
CreateStandaloneCollection EBNF
CreateStandaloneCollection ::= "CREATE" "ANALYTICS"? "COLLECTION" ("IF" "NOT" "EXISTS")?
QualifiedName
"PRIMARY" "KEY" "(" FieldList ")" ( "AUTOGENERATED" )?
CreateStandaloneCollection Diagram
Show FieldList Diagram
Show FieldDef Diagram
Show FieldName Diagram
Show FieldType Diagram
Example
The following example creates a standalone collection that is similar to the collections you can create for the sample Commerce data. In this example, you instruct the system to generate the primary keys for the data you’ll add to this collection. See Install the Commerce Dataset.
CREATE COLLECTION sampleAnalytics.Commerce.locations
PRIMARY KEY (pk: UUID) AUTOGENERATED;
Arguments
- PRIMARY KEY
-
The
PRIMARY KEY
clause indicates the field or fields to use as the primary key for the collection.
- FieldType
-
The
FieldType
can be any of the primitive data types, whereINT
is an alias forBIGINT
.If you prefer that the system generate a primary key for you, supply a
FieldName
with aFieldType
ofUUID
followed byAUTOGENERATED
.
Populating a Standalone Collection
After you create a standalone collection, you can use the following DML statements to add, update, and remove data:
As an alternative to using a CREATE statements followed by a DML statement, you can both create a standalone collection and populate it with the results of a query by using CREATE COLLECTION AS.
|