---
title: CREATE a Standalone Collection
description: This topic describes how you use the <code>CREATE</code> statement
  to create a standalone collection in Enterprise Analytics.
pubDate: 2026-08-17T09:53:44.266Z
antora:
  editUrl: https://github.com/couchbaselabs/docs-enterprise-analytics/edit/release/2.0/modules/sqlpp/pages/5_ddl_standalone.adoc
  xref: xref:2.0@enterprise-analytics:sqlpp:5_ddl_standalone.adoc[]
---

[Consult the llms.txt file for a full list of contents](/llms.txt)
[View original HTML](/enterprise-analytics/2.0/sqlpp/5_ddl_standalone.html)

# CREATE a Standalone Collection

> This topic describes how you use the `CREATE` statement to create a standalone collection in Enterprise Analytics. 

![ CreateRemoteCollection | CreateExternalCollection | CreateStandaloneCollection ](_images/CreateCollection.png) 

To create a standalone collection you use CREATE COLLECTION syntax that does not include either the `EXTERNAL` keyword or an `ON` clause.

## [](#syntax)Syntax

**CreateStandaloneCollection EBNF** 

```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" )?](_images/CreateStandaloneCollection.png) 

**Show FieldList Diagram** 

![FieldDef ("," FieldDef)* ](_images/FieldList.png) 

FieldList

**Show FieldDef Diagram** 

![FieldName ":" FieldType](_images/FieldDef.png) 

FieldDef

**Show FieldName Diagram** 

![Identifier ("." Identifier)*](_images/FieldName.png) 

FieldName

**Show FieldType Diagram** 

![Identifier](_images/FieldType.png) 

FieldType

## [](#example)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 [intro:connecting-to-data-sources.adoc#install-the-commerce-dataset-in-standalone-collections](../intro/connecting-to-data-sources.md#install-the-commerce-dataset-in-standalone-collections).

```SQL++
 CREATE COLLECTION sampleAnalytics.Commerce.locations
 PRIMARY KEY (pk: UUID) AUTOGENERATED;
```

## [](#arguments)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](10%5Fdata%5Ftype.md#PrimitiveTypes), 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)Populating a Standalone Collection

After you create a standalone collection, you can use the following DML statements to add, update, and remove data:

* [COPY INTO Statements](5%5Fdml%5Fcopy%5Fin.md)
* [INSERT INTO Statements](5%5Fdml%5Finsert.md)
* [UPSERT INTO Statements](5%5Fdml%5Fupsert.md)
* [DELETE Statements](5%5Fdml%5Fdelete.md)

> [!TIP]
> 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](5%5Fdml%5Fcreate%5Fas.md).