Skip to content

Instantly share code, notes, and snippets.

@ianmcook
Created September 25, 2025 00:49
Show Gist options
  • Save ianmcook/355fde6a4effbf100d2526b84be6a0a1 to your computer and use it in GitHub Desktop.
Save ianmcook/355fde6a4effbf100d2526b84be6a0a1 to your computer and use it in GitHub Desktop.
How to create games data in several formats

To create games.duckdb, download games.txt from https://github.com/ianmcook/coursera-datasets/blob/master/games.txt, open duckdb and run:

ATTACH 'games.duckdb' as main_db (BLOCK_SIZE 16384);
USE main;
CREATE TABLE games (
    id INTEGER,
    name VARCHAR,
    inventor VARCHAR,
    year VARCHAR,
    min_age TINYINT,
    min_players TINYINT,
    max_players TINYINT,
    list_price DECIMAL(5,2)
);
INSERT INTO games SELECT * FROM read_csv_auto(
    'games.tsv',
    delim='\t',
    header=True
);

To create games.sqlite do something similar but use ATTACH 'games.sqlite' (TYPE sqlite);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment