Setting Up Your Environment
Install MySQL or PostgreSQL locally, connect with a client, and understand how SQL tools work — or use the browser playground and skip straight to Lesson 05
Quick answer
You can run every query in this course in the browser playground on each lesson, which runs SQLite over the FreshCart sample database. For a local setup, install PostgreSQL (or MySQL) and connect with a client such as DBeaver.
- The playground needs no install and resets every time you reload.
- PostgreSQL is the most common choice at US tech companies; MySQL is the common alternative.
- SQLite runs from a single file with no server, which makes it ideal for learning.
SELECT COUNT(*) AS customers_loaded
FROM customers;Result · 1 row
| customers_loaded |
|---|
| 20 |
// Part 01
You Already Have a Working SQL Environment
Before going any further — you already have a fully functional SQL environment running in your browser. The playground on every page of this course uses SQLite (via sql.js) — a real, production-grade database engine that runs entirely in your browser with the complete FreshCart database preloaded. Every query you write here is real SQL. Every concept you learn here works identically in MySQL and PostgreSQL.
This lesson is for when you want to go further — when you want a local installation that you can use for your own projects, connect to from your code, or use in job interviews where they ask you to run queries on their database. A local installation is not required to complete any module in this course. If you just want to write SQL, skip to Lesson 05 right now.
// Part 02
Which Database Should You Install?
If you decide to install a local database, you have three realistic options. Here is exactly how to choose between them.
The SQL you write in this course works on all three. The tiny syntax differences (like AUTO_INCREMENT vs SERIAL vs INTEGER PRIMARY KEY) are noted where they appear. For the rest of this lesson, instructions are given for both PostgreSQL and MySQL side by side.
// Part 03
Option A — Online SQL Tools (Zero Install)
Before installing anything locally, consider whether an online tool meets your needs. These are real database servers running in the cloud — you write SQL in the browser, the server executes it, results come back. No install, no account required for most.
sqliteonline.com
Zero friction. Open the URL and start typing SQL. SQLite dialect. Upload your own CSV to create tables. Best for quick experiments.
Best for: Quick experiments, no setup at all
dbfiddle.uk
Supports MySQL, PostgreSQL, and SQLite. Write your schema in one panel, your query in another, see results instantly. Share your query via URL.
Best for: Testing queries, sharing with colleagues
supabase.com
Free account gives you a real PostgreSQL database in the cloud. Full SQL editor, table viewer, and REST API. The closest to a production PostgreSQL without local install.
Best for: Learning PostgreSQL with a real cloud database
planetscale.com
Free tier gives you a MySQL-compatible database. Built for scale. Good if you want to learn with a cloud MySQL database.
Best for: Learning MySQL with cloud hosting
// Part 04
Option B — Install PostgreSQL Locally
Windows
macOS
Linux (Ubuntu / Debian)
// Part 05
Option C — Install MySQL Locally
Windows
Download MySQL Installer from dev.mysql.com/downloads/installer. Choose the "mysql-installer-community" option (the larger file). Run the installer, choose "Developer Default" setup type. When prompted for a root password, set something you will remember. The installer also installs MySQL Workbench — a visual client — which is what most beginners use.
macOS
Linux (Ubuntu / Debian)
// Part 06
SQL Clients — The Tools You Will Actually Use Day to Day
The command-line clients (psql, mysql) work, but most professional SQL work is done in a GUI client — a visual application where you write queries, see results in a table, browse your schema, and manage connections without memorising command-line flags. Here are the four most-used SQL clients in US tech companies.
Free & open source
PostgreSQL, MySQL, SQLite, Oracle, SQL Server, 50+ more
The most popular SQL client in the world. Connects to any database. Built-in ER diagram generator, data export, schema comparison. The tool used by most data engineers and analysts at US startups.
dbeaver.io
Free (limited) / $89 one-time
PostgreSQL, MySQL, SQLite, Redis, and more
Beautiful, fast, native app for macOS and Windows. Excellent tab management, query history, and safe mode (prevents accidental writes in production). Popular at product companies and startups.
tableplus.com
Free & open source
PostgreSQL only
The official PostgreSQL GUI. Installed automatically with the PostgreSQL Windows installer. Powerful for PostgreSQL-specific features but can be slow. Installed by default — a reliable starting point.
pgadmin.org
Free & open source
MySQL only
The official MySQL GUI from Oracle. Visual query builder, ER diagram tool, performance dashboard. Installed with the MySQL Windows installer. Standard tool in companies running MySQL.
mysql.com/products/workbench
🎯 Pro Tip
Download DBeaver. It is free, works with every database you will ever use (PostgreSQL, MySQL, SQLite, Oracle, Snowflake, BigQuery — all from one client), and is the tool used by most data engineers and analysts at US companies. Learning one client well is more valuable than switching between multiple specialised ones.
// Part 07
Load the FreshCart Database Locally
Once your local database is running, you can load the full FreshCart dataset into it. This lets you practice every query from this course on your local machine — useful when you want to experiment beyond what the browser playground allows.
PostgreSQL
MySQL
data/sql-freshcart.ts file in the Chaduvuko GitHub repository. Copy the SQL from the FRESHCART_SEED_SQL constant and run it after the CREATE TABLE statements above.// Part 08
Understanding SQL Dialects — The Differences That Matter
SQL is a standard (ISO/ANSI SQL) but every database implements it slightly differently. These variations are called SQL dialects. For 95% of what you write in this course — SELECT, WHERE, JOIN, GROUP BY, window functions, CTEs — the syntax is identical across all relational databases. The differences only show up in specific areas.
| Feature | PostgreSQL | MySQL | SQLite / DuckDB |
|---|---|---|---|
| Auto-increment PK | GENERATED ALWAYS AS IDENTITY | AUTO_INCREMENT | INTEGER PRIMARY KEY (implicit) |
| String concatenation | || operator: 'a' || 'b' | CONCAT('a', 'b') | || operator (same as PostgreSQL) |
| Current timestamp | NOW() or CURRENT_TIMESTAMP | NOW() or SYSDATE() | CURRENT_TIMESTAMP |
| Date difference | date1 - date2 (returns interval) | DATEDIFF(date1, date2) | DATEDIFF(date1, date2) |
| Limit rows | LIMIT n OFFSET m | LIMIT n OFFSET m | LIMIT n OFFSET m |
| Boolean type | BOOLEAN (true/false) | TINYINT(1) (1/0) | INTEGER (1/0) |
| String case sensitive? | Yes by default | No by default (uses collation) | Yes by default |
| ILIKE (case-insensitive LIKE) | Supported natively | Use LIKE (already case-insensitive) | Not supported, use LOWER() |
| JSON support | JSON, JSONB (binary, indexable) | JSON (text-based) | Limited JSON functions |
| Full text search | tsvector/tsquery built-in | FULLTEXT index | FTS5 extension |
In this course, when a syntax difference matters we will show both the PostgreSQL/standard version and the MySQL version. The concepts — what the query is doing — are always the same. The dialect is just the spelling.
// Part 09
VS Code as a SQL Editor — The Professional Setup
Most professional SQL work at US tech companies does not happen in pgAdmin or MySQL Workbench. It happens in VS Code with database extensions. This gives you SQL editing with autocomplete, syntax highlighting, query history, and schema browsing — all inside the same editor you use for everything else.
Setup: VS Code + SQLTools
🎯 Pro Tip
VS Code with SQLTools is how most data engineers and analysts actually work in production. You can have your Python pipeline code open in one tab and the SQL it uses in the next tab — same editor, same shortcuts, same git integration. It is a significantly better workflow than switching between separate applications.
// Part 10
What This Looks Like at Work
You join a Seattle startup as a data analyst. On your first day, the engineering manager gives you database credentials and tells you to explore the data before your first standup. Here is exactly what that first hour looks like.
// Part 11
Interview Prep — 5 Questions With Complete Answers
PostgreSQL and MySQL are both mature, production-grade open-source relational databases. The practical differences: PostgreSQL is more standards-compliant — it follows the SQL standard more closely and supports more advanced features natively, including better window functions, more flexible JSONB storage and indexing, more powerful full-text search, and a broader set of data types. MySQL has a simpler setup experience and historically had better replication tooling, which made it dominant in high-read consumer web applications.
The US tech industry has largely converged on PostgreSQL for new projects. Stripe, Brex, Robinhood, Acorns, and most high-growth startups choose PostgreSQL. MySQL remains strong in companies that built their stack before 2015 (DoorDash, Sephora) and are maintaining existing infrastructure.
For a new project in 2026, I would recommend PostgreSQL. It handles every workload MySQL handles, plus more advanced analytical queries, better JSON support, and stronger compliance with the SQL standard — meaning less surprising behaviour when writing complex queries.
The information_schema is a read-only schema that exists in every SQL-compliant database (PostgreSQL, MySQL, SQLite) containing metadata about the database itself — tables, columns, constraints, indexes, views, and privileges. It is a database of databases: you query it with SQL just like any other table, but instead of business data, it returns information about the database structure.
The most useful tables in information_schema: information_schema.tables lists every table and view in the database with their names, schemas, and row estimates. information_schema.columns lists every column in every table — its name, data type, whether it is nullable, and its default value. information_schema.table_constraints lists all constraints (PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK) on every table. information_schema.referential_constraints shows foreign key relationships between tables.
In practice, information_schema is used for: automated documentation generation, schema migration scripts that need to check whether a table or column already exists before creating it, data profiling tools, and ad-hoc exploration when joining a new project and trying to understand the database structure programmatically.
A database server is the software that runs continuously in the background, manages data storage, processes queries, and enforces all database rules. It listens on a network port (5432 for PostgreSQL, 3306 for MySQL) for incoming connections. The server is where your data lives and where queries are executed.
A SQL client is any software that connects to the database server, sends queries, and displays the results. The client does no execution — it sends SQL text to the server over the network, receives the result set back, and presents it in a usable format. A client can be a command-line tool (psql, mysql), a GUI application (DBeaver, TablePlus, pgAdmin), or application code in any language (Python with psycopg2, Node.js with pg, Java with JDBC).
The distinction matters for troubleshooting. If a query is slow, the slowness is almost always on the server (bad query plan, missing index, table scan) — not the client. If a connection fails, the problem is between the client and server — network, firewall, credentials, or the server not running. If results look wrong, that is a query logic problem, which belongs to whoever wrote the query.
WHERE and LIMIT both reduce how many rows you see in the output, but they operate at completely different points in query execution and have completely different performance implications.
WHERE filters rows before they are processed — the database reads pages from disk, applies the WHERE condition to each row, and only passes rows that match the condition forward for further processing. If WHERE uses an indexed column, the database can skip entire pages of data and only read the relevant ones. A well-written WHERE clause can turn a full-table scan of 500 million rows into an index lookup of 10 rows — a 50-million-fold performance improvement.
LIMIT stops returning rows after n have been found. It does not filter rows — it stops counting. Crucially, the database must still find candidate rows (either through a table scan or an index scan) before LIMIT cuts the output. Running SELECT * FROM orders LIMIT 10 without a WHERE clause still potentially triggers a full table scan — the database finds rows in storage order and stops after 10. On a 500-million-row table with no WHERE clause, LIMIT 10 returns fast by luck (first 10 rows happen to be near the start), but it is not a substitute for proper filtering. Always use WHERE to filter the data you actually want; use LIMIT to cap the output size as an additional safeguard.
The first step is to understand the environment you are connecting to — specifically whether this is a production database, a staging database, or a development replica. This changes everything about how carefully you must write queries. On production, a SELECT * on a large table can lock pages and slow down the application. An accidental UPDATE without a WHERE clause can corrupt live data. Always ask which environment the credentials are for and treat production credentials with maximum caution.
Second, explore the schema before writing any business queries. List all tables, look at their structure (columns and data types), and understand the foreign key relationships between them — ideally by looking at an ER diagram if one exists, or generating one from the database client. This prevents writing queries on assumptions that turn out to be wrong about which table holds what data.
Third, check table sizes before running any broad queries. SELECT COUNT(*) FROM each major table tells you whether you are dealing with 10,000 rows or 10 billion. This knowledge changes how you write every query — whether to add indexes, whether to use LIMIT defensively, whether to run queries during off-peak hours. Only after completing these three steps do you write the first business query — and that first query always starts with LIMIT 100 until you are confident it performs well.
// Part 12
Errors You Will Hit — And Exactly Why They Happen
🎯 Key Takeaways
- ✓The browser playground on every module page is a full SQL environment using SQLite (via sql.js). It is sufficient to complete every module in this course without any local installation.
- ✓PostgreSQL is the recommended local database for US tech careers in 2026 — used by Stripe, Brex, Robinhood, Acorns, and most high-growth startups.
- ✓MySQL is the alternative with easier initial setup — used by DoorDash, Sephora, and many consumer web companies.
- ✓SQLite is the simplest option with zero server setup — runs from a single file. Not used in production web backends but excellent for learning and mobile development.
- ✓DBeaver is the recommended SQL client — free, open source, works with PostgreSQL, MySQL, SQLite, Oracle, Snowflake, BigQuery, and 50+ more from one application.
- ✓SQL dialects differ in specific areas: auto-increment syntax (GENERATED ALWAYS AS IDENTITY vs AUTO_INCREMENT), string concatenation (|| vs CONCAT()), boolean types, and some date functions. Core SQL — SELECT, WHERE, JOIN, GROUP BY, window functions, CTEs — is 95% identical across all databases.
- ✓The information_schema is a built-in read-only schema in every SQL database. Query information_schema.tables for table lists, information_schema.columns for column structure, and information_schema.table_constraints for constraint details.
- ✓When joining a new company: confirm whether credentials are for production or staging, explore schema before writing queries, check table sizes with COUNT(*) before running broad queries, and always add LIMIT to exploratory queries.
- ✓VS Code with the SQLTools extension is how most data engineers write SQL professionally — same editor, same git integration, autocomplete and schema browsing without switching applications.
- ✓The five online SQL tools worth knowing: SQLiteOnline.com (zero friction), DB Fiddle (multi-database), Supabase Studio (real cloud PostgreSQL), PlanetScale (cloud MySQL), and the Chaduvuko browser playground (FreshCart preloaded).
What comes next
Lesson 05 is where the actual SQL writing begins. You will write your first real query — SELECT and FROM — and understand exactly what the database does when it executes it. This is the module where SQL starts to feel like a superpower.
Lesson 05 → Your First Query →Quick check
Which database engine does the lesson playground run?
HELP US IMPROVE
How was this lesson?
Your note is shared with the Chaduvuko team for review. Please don’t include personal or sensitive information.
Spotted a mistake or something unclear? Suggest a fix on GitHub or email us. Select the text first and it is quoted for you.
Discussion
0Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.
