Database Setup for Analysts: Which One, Installed How, and What to Do First
Every analyst eventually needs a database of their own: somewhere to put a file that outgrew Excel, somewhere to practise, somewhere to keep a table that four spreadsheets currently disagree about.
What you do: pick by how fast you need to be querying, not by which name looks most professional on a CV. The SQL is nearly the same in all of them.
The short version. Start with SQLite. Add DuckDB when the files get big. Learn Postgres when a job asks for it.
The four options
| Option | Minutes to first query | Genuinely for | Cost |
|---|---|---|---|
| SQLite | 5 | Learning, personal projects, one-file datasets | Free, no install on most systems |
| DuckDB | 5 | Analytical queries over large CSV and Parquet | Free |
| PostgreSQL | 45 | Anything with users, or a real application | Free, but it is a server |
| Hosted free tier | 15 | Sharing with someone else, or a portfolio piece | Free tier, then paid |
SQLite
A database is a single file. No server, no account, no port. Python ships with it, so import sqlite3 works with nothing installed, and DB Browser for SQLite gives you a free graphical client if you would rather click than type.
The SQL is standard enough that everything you learn transfers. The things it does not have are the things a learner does not need yet: user accounts, concurrent writers, strict types.
DuckDB
Also a single file, also no server, and built for exactly the work analysts do: aggregate a lot of rows. It reads CSV and Parquet directly, so a large file can be queried before any import happens at all. If a file has beaten Excel, this is usually the shortest route to an answer, as in opening a large CSV.
PostgreSQL
A proper database server. Users, permissions, concurrency, extensions, and the closest free thing to what a company runs. It is the right choice if you are working towards analytics engineering, and it is more setup than a beginner needs on day one. Step by step in installing PostgreSQL.
A hosted free tier
Supabase, Neon, Railway and similar give you a Postgres instance in a browser. Useful when something else needs to reach the database, or when a portfolio project should have a live link. The cautions are the ordinary ones: free tiers pause or expire, and anything you upload leaves your machine, so nothing confidential goes there.
The five-minute SQLite start
python
>>> import sqlite3
>>> con = sqlite3.connect('analysis.db')
>>> con.execute("CREATE TABLE orders(order_id INT, region TEXT, amount INT)")
>>> con.execute("INSERT INTO orders VALUES (101,'North',120)")
>>> con.commit()
>>> con.execute("SELECT COUNT(*), SUM(amount) FROM orders").fetchall()
[(1, 120)]
commit() is the line beginners miss. Without it the insert is not saved, and the table looks empty next time you connect.
For a graphical route: install DB Browser for SQLite, File, New Database, then File, Import, Table from CSV file. That covers the whole loop without typing any SQL, which is a reasonable way to start.
The first five things to do once it runs
- Load one real file you actually care about. Practice data teaches syntax; your own data teaches analysis. The load step is in loading your first CSV.
- Count the rows and compare with the source. Every project starts here.
- Check the types. A column of numbers imported as text will sort 100 before 20 and sum to nothing.
- Write five questions in English before writing any SQL, then answer them one at a time.
- Save the queries in a file, with comments. A query you cannot find again was practice, not work.
Where the data goes
Three habits that save a bad afternoon later:
- Keep the database file and the raw source files in the same project folder, with the raw files never edited.
- Back up the database file by copying it. For SQLite and DuckDB that is the entire backup procedure.
- Do not put a database file in a syncing folder that could write to it from two machines. That is how a file gets corrupted.
How to apply this to your own work
- Install SQLite today and load one CSV you already use. Twenty minutes end to end.
- Add DuckDB the first time a file is too big for Excel, rather than the third time.
- Check the job adverts you are aiming at, and learn Postgres if they name it.
- Keep a queries file per project from the start, so nothing has to be rewritten from memory.
- Reconcile every load against a row count. It is the check that catches everything else.
The one habit to keep
Load your own data early. A database with practice data in it teaches syntax. A database with your own data in it starts answering questions somebody is asking you, which is the point at which the tool stops being homework.
What is the file you would load first, if you had a database this afternoon?
SQL for Analysts is 458 pages that read queries line by line in everyday words, so a result that came back wrong has somewhere to be traced instead of being retyped until it looks better.
SQL for Analysts, $19 →Setting up a SQL database walks the SQLite route step by step, which database to install compares them further, and sample databases gives you data to practise on.
Set Up a SQL Database →