CREATE a Standalone Collection

  • Capella Columnar
  • reference
    +
    This topic describes how you use the CREATE statement to create a standalone collection in Capella Columnar.
     CreateRemoteCollection | CreateExternalCollection | CreateStandaloneCollection

    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
    "CREATE" "COLLECTION" ("IF" "NOT" "EXISTS")? QualifiedName "PRIMARY" "KEY" "(" FieldList ")" ( "AUTOGENERATED" )?
    Show FieldList Diagram
    FieldDef ("," FieldDef)*
    FieldList
    Show FieldDef Diagram
    FieldName ":" FieldType
    FieldDef
    Show FieldName Diagram
    Identifier ("." Identifier)*
    FieldName
    Show FieldType Diagram
    Identifier
    FieldType

    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, where INT is an alias for BIGINT.

    If you prefer that the system generate a primary key for you, supply a FieldName with a FieldType of UUID followed by AUTOGENERATED.

    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.