# Use Namespacing for Organizing Data

Much like relational databases, DeltaStream uses [databases](https://docs.deltastream.io/overview/core-concepts/databases "mention")s and namespaces for logically organizing data, regardless of the [store](https://docs.deltastream.io/overview/core-concepts/store "mention") in which the data resides.

You can use this logical separation to namespace [queries](https://docs.deltastream.io/overview/core-concepts/queries "mention") statements based on the scope of the query and what stores are involved. This is of particular value when your stores are accessible by more than one team and you require collaboration on the data.

All DeltaStream objects are hosted in a database and namespace. Here's how to use this framework to organize your data:

## Create a Database

In addition to [store](https://docs.deltastream.io/how-do-i.../create-and-manage-data-stores/store "mention"), you must also create a database to process data. To do this:

1. In the lefthand navigation, click **Workspace** ( ![](https://1288764042-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdbd9e6ZJodkgF1H6AVay%2Fuploads%2F5EudXKVDSWZLByUuGbyy%2F5.png?alt=media) ). Then, to the right of **Database**, click **+**, and then **Database**.<br>

   <figure><img src="https://1288764042-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdbd9e6ZJodkgF1H6AVay%2Fuploads%2Fx57sGgjUWsnzWoVeyPn0%2FAddingDatabase.png?alt=media&#x26;token=01d695e1-b98d-45c5-8e3a-db93ca09c9d9" alt="" width="344"><figcaption><p>Adding a Database</p></figcaption></figure>
2. At the prompt, enter a unique name for the database and then click **Add**.

The new database displays in the **Database** list of available databases.

## Using Database Namespaces

You can use namespaces to further organize objects within a database. This makes it possible to manage complex projects.

Here's an example: refining your `pageviews` events before you share them with your business analytics team for further analysis.

1. Aggregate the page visits for each user and write that into a `my-db.analytics.user_visits` stream:

<figure><img src="https://1288764042-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdbd9e6ZJodkgF1H6AVay%2Fuploads%2FswysQGQ2YP0H5fXSce61%2FAggregatePageVisitsAsStream.png?alt=media&#x26;token=2e89cd45-24a4-4f8c-83f3-2fc37f3a779d" alt="" width="563"><figcaption><p>Aggregating Page Visits as a Stream</p></figcaption></figure>

2. Use the new `page_visits` stream and enrich it with the user’s latest location for a full picture on how your users are visiting pages on your website.\
   Here, you're using your users’ [#\_changelog](https://docs.deltastream.io/overview/core-concepts/databases#_changelog "mention") object to get the location information.
3. Write this into the analytics team’s public namespace in the `analytics-db`, `analytics-ds.public.user_visit_location`:

<figure><img src="https://1288764042-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdbd9e6ZJodkgF1H6AVay%2Fuploads%2FgOSaUhIB4a2Pt1BH2M8u%2FWriteUserLocationResults.png?alt=media&#x26;token=e5d9a4f9-034a-4bc4-9220-8144a66bb624" alt="" width="563"><figcaption><p>Writing User Location Results</p></figcaption></figure>

## Reducing Clutter and Taming the Chaos

Using databases and namespaces, you can reduce clutter in the `analytics-db` . To do this:

1. Refine the necessary data in the `my-db` database.
2. Use the refinement to push an enriched set of records to the `public` namespace of the `analytics-db`.

{% hint style="success" %}
**Tip** This namespacing approach enables you to organize where to write data into and where it resides, while also ensuring the right consumer can access it across your company.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/how-do-i.../database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
