The eternal fresher question. The honest answer: both are fine for most apps — but they think differently.
The mental models
-- MySQL: tables, rows, strict schema
students (id, name, dept_id)
depts (id, name) -- related via foreign keys + JOINs
// MongoDB: JSON-like documents, flexible schema
{
name: "Priya",
dept: "CSE",
marks: [ { subject: "CN", grade: "A+" } ] // nested — no JOIN needed
}Choose MySQL/PostgreSQL when…
- Data is relational: orders↔customers↔payments
- You need transactions and strict consistency (money!)
- Reporting and complex queries matter
Choose MongoDB when…
- Schema evolves fast (startups, prototypes)
- Data is naturally document-shaped: profiles, catalogs, content
- You're in the MERN stack — Mongoose + Node is frictionless
Interview one-liner
"SQL databases scale vertically with strong consistency and joins; document stores trade schema rigidity for flexibility and horizontal scaling. I'd pick based on how relational the data is."
← All Articles