0Pricing
MongoDB Academy · Lesson

Collections vs SQL Tables

Learners will contrast MongoDB collections with relational tables and appreciate how a flexible schema changes data design.

Tables vs Collections at a Glance

SQL's basic unit is the table, where every row has identical columns. MongoDB's is the collection — a group of documents that can each differ.

Fixed Schema: The SQL Way

SQL needs a fixed schema defined before any data goes in, and changing it later can rebuild the whole table. Rigid, but predictable and storage-efficient.

-- SQL table: schema defined upfront, rigid
CREATE TABLE users (
  id         SERIAL PRIMARY KEY,
  name       VARCHAR(100) NOT NULL,
  email      VARCHAR(200) UNIQUE NOT NULL,
  age        INT,
  created_at TIMESTAMP DEFAULT NOW()
);
-- Every row must have exactly these columns

All lessons in this course

  1. What Is a BSON Document?
  2. Collections vs SQL Tables
  3. Databases, Collections, and Namespaces
  4. The mongosh Shell Essentials
← Back to MongoDB Academy