← Get startedSELECT * FROM TheShiraverse · All Nukte
Get started › Load the dataset

Load the RetailMart dataset

Download the data, run one script, and check the numbers. About 55 tables and 24 lakh rows, in a database called retailmart. Same steps on Mac and Windows.

Jo video mein bola, yahan nukte mein likha hai.
What I said in the video, written here as key points.

▶ Watch on YouTube

Put RetailMart on your laptop

๐Ÿ”’
retailmart
55 tables, about 24 lakh rows. Read-only. Look, don't touch.
๐Ÿงช
practice
Yours. Create, break, experiment.

Asli data, apne laptop par. Real data, on your own laptop. Same steps on Mac and Windows.

Once the tools are installed, load the practice data: 55 tables and about 24 lakh rows. It goes into its own database called retailmart. Your practice database stays separate, for the tables you create yourself. Never edit the retailmart tables. The steps are the same on Mac and Windows. Only the way you open the folder differs, and this page shows both.

Step 1 · Download and unzip

๐Ÿ“ฆ
select-from-shiraverse-dataset.zipabout 54 MB
↓
๐Ÿ“
csv + sqltwo folders inside

Mac: double-click. Windows: Extract All.

Download the dataset (about 54 MB) with the button above, or from the Setup page. On Mac, double-click the zip. On Windows, right-click it and choose Extract All. You get a folder that contains two folders: csv and sql.

Step 2 · Open the folder in VS Code

1
Open the folderVS Code ▸ File ▸ Open Folder ▸ pick select-from-shiraverse-dataset
2
Open the terminalTerminal ▸ New Terminal (Ctrl + `). It opens already inside this folder.
3
Windows: use Git BashIf it says PowerShell: Ctrl+Shift+P ▸ Terminal: Select Default Profile ▸ Git Bash. Mac: skip, the default is fine.
VS Code · TERMINAL (Git Bash on Windows)– □ ×
~/Downloads/select-from-shiraverse-dataset $ ls csv   sql

No cd needed: VS Code starts the terminal inside the folder. You will use this same terminal all course.

We will run everything from VS Code, so the terminal, the files and later your SQL all live in one window. After you unzip, open VS Code and choose File → Open Folder, then pick the select-from-shiraverse-dataset folder. (Or, from any terminal inside that folder, type code .)

Open the terminal with Terminal → New Terminal (shortcut Ctrl + `). It starts inside the folder you opened, so you do not need cd. Type ls: you must see csv and sql.

ls

Windows: the terminal may open as PowerShell. We want Git Bash (it came with Git), because the same commands then work on Windows and Mac. Press Ctrl + Shift + P, type Terminal: Select Default Profile, choose Git Bash, then close the terminal and open a new one. You only do this once. Mac: the default terminal already works, nothing to change.

If you opened a terminal somewhere else instead, go to the folder yourself:

cd ~/Downloads/select-from-shiraverse-dataset
ls

Step 3 · Run the load script

$psql -U postgres -d postgres -f sql/setup_retailmart.sql
Press Replay to watch the load.
0pages (rows) loaded
Real run: about a minute, same 16 schemas, 55 tables.
🪟 WindowsIt asks Password for user postgres: Type postgres and press Enter. The letters do not show while you type. That is normal.
🍎 MacNo password is asked. It just starts.

Same command on both. A page called watch-the-load.html opens in your browser by itself and shows your laptop loading it, live. Wait for Setup Complete.

Run this on Mac or Windows. It is the same command:

psql -U postgres -d postgres -f sql/setup_retailmart.sql

On Windows it asks for the password: you will see Password for user postgres:. Type postgres (the password our installer set) and press Enter. The letters do not appear while you type, that is normal. On Mac it does not ask for a password, it just starts. The load takes about a minute. While it works you will see 4 simple steps and one line with an icon for each group of tables, with the rows loaded. Nothing to type, nothing to fix: just wait for the green tick and Setup Complete. This is what a normal run looks like (it prints "Setup Complete" at the end):

  ==============================================================
   ๐Ÿ›’  RETAILMART  -  building your practice shop
   Sit back. This takes about a minute. Nothing for you to do.
  ==============================================================

  ๐Ÿ’พ  Step 1 of 4   Database "retailmart" created
  ๐Ÿ”จ  Step 2 of 4   Built 16 almirahs (schemas) and 55 books (tables)
  ๐Ÿ“ฅ  Step 3 of 4   Filling the shelves with data
        ๐Ÿงญ  core .................        960 rows  โœ…
        ๐Ÿฌ  stores ...............     23,200 rows  โœ…
        ๐Ÿ“ฆ  products .............   1,21,106 rows  โœ…
        ๐Ÿ‘ฅ  customers ............   1,55,000 rows  โœ…
        ๐Ÿ›’  sales ................   7,80,104 rows  โœ…
        ๐Ÿ’ฐ  finance ..............     40,788 rows  โœ…
        ๐Ÿ‘”  hr ...................   1,24,310 rows  โœ…
        ๐Ÿ“ฃ  marketing ............      4,750 rows  โœ…
        ๐ŸŽง  support ..............     10,000 rows  โœ…
        ๐ŸŒ  web_events ...........   7,00,000 rows  โœ…
        ๐Ÿšš  supply_chain .........     38,505 rows  โœ…
        ๐ŸŽ  loyalty ..............     40,004 rows  โœ…
        ๐Ÿญ  manufacture ..........     15,010 rows  โœ…
        ๐Ÿ’ต  payroll ..............     12,006 rows  โœ…
        ๐Ÿ“ž  call_center ..........     50,000 rows  โœ…
        ๐Ÿ”  audit ................     80,000 rows  โœ…
        ๐Ÿ’ฐ  finance (more) .......   1,43,159 rows  โœ…
        ๐Ÿ‘ฅ  customers (more) .....     50,000 rows  โœ…
        ๐Ÿ”  audit (more) .........      2,700 rows  โœ…
  ๐Ÿ“  Step 4 of 4   Adding a short note on every almirah and book

  ==============================================================
   โœ…  Setup Complete! Connected to retailmart
   16 almirahs (schemas)  |  55 books (tables)  |  23,91,602 pages (rows)
  ==============================================================

   ๐Ÿ‘‰  Next, check it:  psql -U postgres -d retailmart -c "SELECT count(*) FROM sales.orders;"

To start over at any time, run the same command again.

While it runs, a page called watch-the-load.html (it is in the sql folder) opens in your browser by itself. It shows your own laptop loading RetailMart, tile by tile, with the rows counting up, like the animation above. If it does not open, double-click that file.

It rebuilds the retailmart database from scratch.

Step 4 · Check the numbers

150000orders in sales.orders
Terminal / Git Bash– □ ×
$ psql -U postgres -d retailmart -c "SELECT count(*) FROM sales.orders;" Password for user postgres: (Windows only) count -------- 150000

See 150000? All of RetailMart is there. Mubarak ho!

Run:

psql -U postgres -d retailmart -c "SELECT count(*) FROM sales.orders;"

You should see 150000. On Windows it asks for the password every time you run psql: type postgres and press Enter. On Mac it does not ask. (If any list ever stops with (END) at the bottom, just press q to leave it.) In pgAdmin 4, refresh the server list and you will see the retailmart database with 16 schemas.

Common problems

could not open file "csv/..."You are not inside the unzipped folder. List the folder and check you see csv and sql.
password authentication failedUse the password you chose during install (postgres for our installer).
psql not foundOpen a new Terminal (Mac) or Git Bash (Windows) window. Still no? See the check page for your system.
Terminal says PowerShell, or psql is not recognizedWindows: in VS Code press Ctrl+Shift+P, choose Terminal: Select Default Profile, pick Git Bash, then open a new terminal.
psql not found right after installingClose VS Code completely and open it again. It picks up the new PATH when it starts.
Want to start overRun the same load command again. It rebuilds retailmart from scratch.

Tell me exactly what the screen says. Ghabrana nahi.

  • could not open file "csv/...": you are not inside the unzipped folder. List the folder and check you see csv and sql.
  • password authentication failed: use the password you chose during install (postgres for our installer).
  • psql not found: open a new Terminal (Mac) or Git Bash (Windows) window. Still no? See the check page for Mac or Windows.
  • Terminal says PowerShell, or psql is not recognized: on Windows press Ctrl + Shift + P in VS Code, choose Terminal: Select Default Profile, pick Git Bash, then open a new terminal.
  • psql not found right after installing: close VS Code completely and open it again so it picks up the new PATH.
  • Want to start over: run the same load command again. It rebuilds retailmart from scratch.

Did you see 150,000?

sql.theshiraverse.com

Tell me in the comments. Milte hain agli video mein. Next: a tour of the database.

→ / Space next   ← back   F fullscreen   H hide bars   N notes