How to Set Up a SQL Database for Beginners
You downloaded a dataset as a CSV file. Every SQL tutorial assumes your data is already "in a database." Nobody explains the step in between. This guide is that step: you'll create your first real database on your own computer, load your CSV into it, and run your first query — using two free tools and zero server setup.
- Understand what you're actually building (60 seconds)
- Install DB Browser for SQLite (free)
- Create a database file
- Import your CSV as a table
- Verify the import with one query
- Fix the two most common import problems
First: what are you actually building?
A database sounds like a big scary server in a data center. For learning and portfolio projects, it isn't. With SQLite, a database is just one file on your computer — like mygames.db sitting in your Documents folder. Inside that file live one or more tables, and a table is just a grid of rows and columns, like a spreadsheet sheet.
So the whole job is: make the file, put your CSV inside it as a table, confirm nothing got lost. That's it.
Step 1 — Install DB Browser for SQLite
Where you'll type everything in this guide is a free desktop app called DB Browser for SQLite. It gives SQLite a friendly point-and-click window plus a tab where you can type SQL.
- Go to sqlitebrowser.org/dl
- Download the installer for Windows or Mac and run it (all defaults are fine)
- Open the app — you'll see a mostly empty window with buttons like New Database and Open Database
Step 2 — Create your database file
- Click New Database (top-left)
- Pick a folder you can find again, name the file something like
portfolio.db, click Save - A "Create Table" dialog pops up — click Cancel. You don't need it; the CSV import in the next step builds the table for you.
That's a real database. It's empty, but it exists — one file, no server.
Step 3 — Import your CSV as a table
- In the menu: File → Import → Table from CSV file…
- Pick your CSV file
- In the import dialog:
- Table name: give it a name ending in
_raw, likesteam_games_raw. The_rawsuffix is an analyst habit: it marks this table as the untouched original. Any cleaning happens later, in a copy — never in the original. - Tick "Column names in first line" — otherwise your header row gets imported as a data row.
- Table name: give it a name ending in
- Click OK, then press Ctrl+S (Cmd+S on Mac) to save the database. DB Browser doesn't write changes to the file until you save.
Step 4 — Verify it with your first query
Click the Execute SQL tab. This is where you type SQL from now on. Type this and press the ▶ (play) button:
SELECT COUNT(*) FROM steam_games_raw;
It returns one number: how many rows are in your table. Compare it to the row count of the source CSV (open the CSV in Excel and check the last row number, minus 1 for the header). If they match, every row arrived. Then eyeball a few rows:
SELECT * FROM steam_games_raw LIMIT 10;
If the columns look right and the count matches — you're done. You have a working SQL database, and every SQL lesson you take from here on applies to your own data.
The two problems that bite everyone once
1. Numbers imported as text
If a price column contains values like $4.99 or 1,299, the dollar sign and comma force it to import as TEXT — and SUM(price) returns garbage. The fix is to clean those values into a new numeric column (in a new table — never edit the _raw one). The SQL Kit's cleaning lessons cover exactly this.
2. Row count doesn't match
Off by exactly one? You probably forgot "column names in first line." Off by more? The CSV likely has quoting or delimiter problems (commas inside un-quoted text fields are the classic). Re-check the separator and quote settings in the import dialog.
Cheat sheet
| Step | Where | Action |
|---|---|---|
| Create database | DB Browser | New Database → save a .db file → Cancel the table dialog |
| Import CSV | File menu | Import → Table from CSV → name it something_raw → tick "column names in first line" |
| Save | DB Browser | Ctrl+S — changes aren't in the file until you save |
| Verify | Execute SQL tab | SELECT COUNT(*) vs the CSV's row count, then LIMIT 10 to eyeball |
Same idea, bigger databases
On the job you'll meet MySQL (LOAD DATA INFILE) and Postgres (COPY). The tools change; the workflow you just learned doesn't: create → import → verify, and keep an untouched _raw copy.
And if the file itself is huge (millions of rows, gigabytes on disk), the same database still works, you just add a few habits: see How to Handle Large Datasets.
The free SQL Kit teaches SELECT, WHERE, JOIN, and GROUP BY with worked examples, practice, flash cards, and a mock exam — all in your browser, nothing to install.
Open the SQL Kit →