Video Game Sales
Note
This page is part of the Dataset Import section, which includes examples of loading popular datasets into YDB. Before starting, please review the general information on requirements and the import process.
Data on video game sales.
Source: Kaggle - Video Game Sales
Size: 1.36 MB
Loading Example
-
Download and unzip the
vgsales.csvfile from Kaggle. -
Create a table in YDB using one of the following methods:
Embedded UIYDB CLIFor more information on Embedded UI.
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 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 );' -
Execute the import command:
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:
Embedded UI
YDB CLI
SELECT
Publisher,
AVG(NA_Sales) AS average_na_sales
FROM vgsales
GROUP BY Publisher
ORDER BY average_na_sales DESC
LIMIT 1;
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;'
Result:
┌───────────┬──────────────────┐
│ Publisher │ average_na_sales │
├───────────┼──────────────────┤
│ "Palcom" │ 3.38 │
└───────────┴──────────────────┘
This query helps find the publisher with the greatest success in North America by average sales.