---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ydb.tech/docs/en/analyst/datasets/video-games.md?version=v25.3
  - https://ydb.tech/docs/ru/analyst/datasets/video-games.md?version=v25.3
  - href: en/analyst/datasets/video-games.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/core/analyst/datasets/video-games.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# Video Game Sales

<!-- source: en/analyst/datasets/_includes/intro.md -->
{% note info %}

This page is part of the [Dataset Import](https://ydb.tech/docs/en/analyst/datasets/index.md?version=v25.3) section, which includes examples of loading popular datasets into YDB. Before starting, please review the [general information](https://ydb.tech/docs/en/analyst/datasets/index.md?version=v25.3#general-info) on requirements and the import process.

{% endnote %}
<!-- endsource: en/analyst/datasets/_includes/intro.md -->

Data on video game sales.

**Source**: [Kaggle - Video Game Sales](https://www.kaggle.com/datasets/gregorut/videogamesales)

**Size**: 1.36 MB

## Loading Example

1. Download and unzip the `vgsales.csv` file from Kaggle.

2. Create a table in YDB using one of the following methods:

    {% list tabs %}

    - Embedded UI

      For more information on [Embedded UI](https://ydb.tech/docs/en/reference/embedded-ui/ydb-monitoring.md?version=v25.3).

      ```sql
      CREATE TABLE `vgsales` (
          `Rank` Uint64 NOT NULL,
          `Name` Text NOT NULL,
          `Platform` Text NOT NULL,
          `Year` Text NOT NULL,
          `Genre` Text NOT NULL,
          `Publisher` Text NOT NULL,
          `NA_Sales` Double NOT NULL,
          `EU_Sales` Double NOT NULL,
          `JP_Sales` Double NOT NULL,
          `Other_Sales` Double NOT NULL,
          `Global_Sales` Double NOT NULL,
          PRIMARY KEY (`Rank`)
      )
      WITH (
          STORE = COLUMN
      );
      ```

    - YDB CLI

      ```bash
      ydb sql -s \
      'CREATE TABLE `vgsales` (
          `Rank` Uint64 NOT NULL,
          `Name` Text NOT NULL,
          `Platform` Text NOT NULL,
          `Year` Text NOT NULL,
          `Genre` Text NOT NULL,
          `Publisher` Text NOT NULL,
          `NA_Sales` Double NOT NULL,
          `EU_Sales` Double NOT NULL,
          `JP_Sales` Double NOT NULL,
          `Other_Sales` Double NOT NULL,
          `Global_Sales` Double NOT NULL,
          PRIMARY KEY (`Rank`)
      )
      WITH (
          STORE = COLUMN
      );'
      ```

    {% endlist %}

3. Execute the import command:

    ```bash
    ydb import file csv --header --null-value "" --path vgsales vgsales.csv
    ```

## Analytical Query Example

To identify the publisher with the highest average game sales in North America, execute the query:

{% list tabs %}

- Embedded UI

  ```sql
  SELECT
      Publisher,
      AVG(NA_Sales) AS average_na_sales
  FROM vgsales
  GROUP BY Publisher
  ORDER BY average_na_sales DESC
  LIMIT 1;
  ```

- YDB CLI

  ```bash
  ydb sql -s \
  'SELECT
      Publisher,
      AVG(NA_Sales) AS average_na_sales
  FROM vgsales
  GROUP BY Publisher
  ORDER BY average_na_sales DESC
  LIMIT 1;'
  ```

{% endlist %}

Result:

```raw
┌───────────┬──────────────────┐
│ Publisher │ average_na_sales │
├───────────┼──────────────────┤
│ "Palcom"  │ 3.38             │
└───────────┴──────────────────┘
```

This query helps find the publisher with the greatest success in North America by average sales.