---
title: "Surreal Deal Store"
description: "Surreal Deal Store, a sample dataset of 12 tables with graph relations and record links, as .surql files to download and import into SurrealDB for trying SurrealQL queries on realistic data."
canonical_url: "https://surrealdb.com/docs/learn/tutorials/demos/surreal-deal-store"
section: "Demos"
surrealdb_version: "4.x"
last_modified: "2026-11-18T02:09:16Z"
---

> Full SurrealDB documentation index: https://surrealdb.com/docs/llms.txt

# Surreal Deal Store

Surreal Deal Store, a sample dataset of 12 tables with graph relations and record links, as .surql files to download and import into SurrealDB for trying SurrealQL queries on realistic data.

To further test out SurrealDB and SurrealQL functionality, we've included two demo datasets here in `.surql` files which you can download and [`import`](/docs/reference/cli/db/commands/import.md) into SurrealDB using the [CLI](/docs/reference/cli/db.md).

## Surreal Deal Store - there is a lot in store for you!

Surreal Deal Store is our demo dataset based on our [SurrealDB Store](https://surrealdb.store/). The dataset is made up of 12 tables using both [graph relations](/docs/reference/query-language/statements/relate.md) and [record links](/docs/reference/query-language/language-primitives/record-links.md).

In the diagram below, the nodes in pink are the [standard tables](/docs/reference/query-language/statements/define/table.md), the ones in purple represent the [edge tables](/docs/reference/query-language/statements/relate.md), which show the relationships between records when SurrealDB is used as a graph database. The nodes in grey are the [pre-computed table views](/docs/reference/query-language/statements/define/table.md).

<img src="~/assets/img/image/light/surreal-deal-store-light.png" darkSrc="~/assets/img/image/dark/surreal-deal-store.png" alt="Surreal Deal Data Model" />

### Download

| Dataset                                                                          | URL                                                       |
| -------------------------------------------------------------------------------- | --------------------------------------------------------- |
| [Surreal Deal Store (mini)](https://datasets.surrealdb.com/datasets/surreal-deal-store/mini-v3.surql) | https://datasets.surrealdb.com/datasets/surreal-deal-store/mini-v3.surql |

### Import

Once one of the datasets has been downloaded, it's now time to [start the server](/docs/reference/cli/db/commands/start.md).

```bash
# Create a new in-memory server
surreal db start --user root --pass secret --allow-all
```

Lastly, use the [import command](/docs/reference/cli/db/commands/import.md) to add the dataset.

Use the command below to import the [surreal deal store dataset](https://datasets.surrealdb.com/surreal-deal-store.surql):

```bash
surreal db import --endpoint http://localhost:8000 --user root --pass secret \
  --ns main --db main surreal-deal-store.surql
```

To import the downloaded [Surreal Deal store (mini)](https://datasets.surrealdb.com/surreal-deal-store-mini.surql) dataset, use the command below:

```bash
surreal db import --endpoint http://localhost:8000 --user root --pass secret \
  --ns main --db main surreal-deal-store-mini.surql
```

Please be aware that the import process might take a few seconds.

### Using Curl

First, start the SurrealDB server:

```bash
# Create a new in-memory server
surreal db start --user root --pass secret --allow-all
```

Then download the file and load it into the database:

```bash
# Download the file
curl -L "https://datasets.surrealdb.com/surreal-deal-store.surql" -o surreal-deal-store.surql

# Load the file into the database using the rest endpoint
curl -v -X POST -u "root:secret" -H "Surreal-NS: main" -H "Surreal-DB: main" -H "Accept: application/json" --data-binary @surreal-deal-store.surql http://localhost:8000/import
```

If you want to use the mini version:

```bash
# Download the file
curl -L "https://datasets.surrealdb.com/surreal-deal-store-mini.surql" -o surreal-deal-store-mini.surql

# Load the file into the database using the rest endpoint
curl -v -X POST -u "root:secret" -H "Surreal-NS: main" -H "Surreal-DB: main" -H "Accept: application/json" --data-binary @surreal-deal-store-mini.surql http://localhost:8000/import
```

### Sample queries

Here are some sample queries you can run on the Surreal Deal Store dataset. We've also included a [SurrealDB Studio Mini](https://app.surrealdb.com/mini) below to help you run these queries.

> [!NOTE]
> The query results below have been limited to 4 records for brevity. If you remove the `LIMIT 4` clause from the queries, you'll see the full results.

```surql
-- Query 1: Using record links to select from the seller table
SELECT
  name,
  seller.name
FROM product LIMIT 4;
-- Query 2: Using graph relations to select from the person and product table
SELECT
    time.created_at as order_date,
    product_name,
    <-person.name as person_name,
    ->product.details
FROM order LIMIT 4;
-- Query 3: Conditional filtering based on an embedded object property.
SELECT
  name,
  email
FROM person
WHERE address.country ?= "England" LIMIT 4;
-- Query 4: Conditional filtering using relationships.
SELECT * FROM review
WHERE ->product.sub_category ?= "Activewear" LIMIT 4;
-- Query 5: Count orders based on order status
SELECT count() FROM order
WHERE order_status IN [ "processed", "shipped"]
GROUP ALL LIMIT 4;
-- Query 6: Get a deduplicated list of products that were ordered
SELECT
    array::distinct(product_name) as ordered_products
FROM order
GROUP ALL LIMIT 4;
-- Query 7: Get the average price per product category
SELECT
    ->product.category AS product_category,
    math::mean(price) AS avg_price
FROM order
GROUP BY product_category
ORDER BY avg_price DESC LIMIT 4;
-- Query 8: encapsulating logic in a function
RETURN fn::number_of_unfulfilled_orders();
-- Query 9: using a custom fuction for currency conversion
SELECT
    product_name,
    fn::pound_to_usd(price) AS price_usd
FROM order LIMIT 4;
```
