Database Overview
What a database is, why apps need one, and how relational vs NoSQL systems differ.
What you'll learn
- What a database is and why every real application needs one
- The difference between a database, a DBMS, and a query language
- Relational (SQL) vs non-relational (NoSQL) databases at a glance
- Common database systems: PostgreSQL, MySQL, SQLite, MongoDB, Redis
Concept
What Is a Database?
A database is an organized collection of data stored so that it can be accessed, managed, and updated efficiently. Unlike a plain file or a spreadsheet, a database is designed to handle concurrent access from many users at once, enforce rules about what data is allowed, and recover safely from crashes. Almost every real-world application — from a blog to a banking system — stores its data in a database.
Database vs DBMS vs Query Language
These three terms are often confused. The database is the data itself. The database management system (DBMS) is the software that stores and retrieves that data (e.g. PostgreSQL, MySQL). The query language (e.g. SQL) is the syntax you use to ask the DBMS to do things. When people say "I use PostgreSQL," they mean they use the PostgreSQL DBMS to manage their database, and they write SQL to interact with it.
Relational vs NoSQL
Relational databases (PostgreSQL, MySQL, SQLite, SQL Server, Oracle) store data in tables with rows and columns, enforce a strict schema, and use SQL. They excel at complex queries, joins, and transactional integrity. NoSQL databases (MongoDB, Redis, Cassandra, DynamoDB) trade strict schema for flexibility — they store documents, key-value pairs, or wide columns, and are often chosen for horizontal scale and unstructured or rapidly changing data.
Popular Database Systems
- PostgreSQL — powerful open-source RDBMS with rich feature set
- MySQL — widely used open-source RDBMS, common in web stacks
- SQLite — lightweight file-based RDBMS, perfect for mobile and prototyping
- MongoDB — document-oriented NoSQL storing JSON-like documents
- Redis — in-memory key-value store, extremely fast for caching
Choosing the right database depends on your data shape, query patterns, scale requirements, and consistency needs.
Example
-- Create a simple table to store users
CREATE TABLE users (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT UNIQUE NOT NULL
);
-- Insert a row
INSERT INTO users (id, name, email)
VALUES (1, 'Ada Lovelace', '[email protected]');
-- Query the data
SELECT * FROM users;
This is a complete mini-example: create a table, insert one row, and read it back. Every relational database supports these three operations.
Try it
- SQL Formatter
Format and beautify SQL queries as you write them.
- JSON to SQL
Convert JSON data into SQL insert statements.
Common mistakes
The mistake
Using a spreadsheet as a database
The fix
Spreadsheets lack concurrency, constraints, and query power. Use SQLite for a zero-config start — it is a single file but a real database.
The mistake
Confusing the database with the DBMS
The fix
The database is the data; the DBMS (e.g. PostgreSQL) is the software that manages it. You write SQL to talk to the DBMS.
Practice Database Overview
4 exercises
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.