Types of Databases: Relational, NoSQL, Hierarchical, Network and Cloud
Not all data is the same, and not all databases are built the same way — a banking system needs guaranteed consistency, a social feed needs to handle massive scale, and an analytics warehouse needs to scan billions of rows in seconds. This guide to the types of databases in DBMS covers all five major categories, with real examples of where each is used, so you understand the landscape before deciding which database to learn first.
What are the Types of Databases?
A database type refers to how a database organizes, stores, and lets you query data, and different types exist because different applications have very different needs. The five major categories are relational, NoSQL (split further into document, key-value, column-family, and graph), hierarchical, network, and cloud databases. As a SQL learner you're focused on the relational model, which remains the dominant choice for structured business data — making it the best starting point in any guide to database types for beginners.
What You'll Learn
- Identify the five major types of databases used in industry.
- Understand the relational model and why SQL is built on it.
- Compare NoSQL database subtypes: document, key-value, column-family, and graph.
- Develop judgment for choosing the right database type for a given scenario.
Key Terms to Know
- Relational database: Stores structured data in tables, uses SQL, and connects tables through keys.
- NoSQL database: A broad category of non-relational databases built for flexibility, scale, or specialized access patterns.
- Document database: A NoSQL database that stores data as JSON-like documents with no fixed schema.
- Key-value store: A NoSQL database optimized for extremely fast lookups by a known key.
- Graph database: A database built for highly connected data, like social networks, modeled as nodes and edges.
Relational Databases: The Foundation of SQL
Relational databases are still the most widely used database type in business applications — MySQL, PostgreSQL, Oracle Database, and Microsoft SQL Server are all relational. They store data in tables, enforce constraints, support transactions, and are queried using SQL. If you're building a web app, a banking system, or an e-commerce platform, a relational database is almost always the right first choice for your core data, which is exactly why most experts recommend it when choosing which database to learn first.
NoSQL Database Types: Document, Key-Value, Column-Family, and Graph
NoSQL database types emerged to handle workloads where the rigid relational model gets in the way. Document databases like MongoDB store data as flexible JSON-like documents, useful when an e-commerce catalog has products with wildly different attributes. Key-value stores like Redis act as ultra-fast lookup tables, ideal for caching, sessions, and leaderboards. Column-family databases like Cassandra are built for write-heavy workloads at massive scale, such as IoT sensor data. Graph databases like Neo4j model entities and their relationships as nodes and edges, which is exactly why LinkedIn uses one to power "People You May Know."
In a relational database vs NoSQL comparison, the real question isn't which is better, it's which data shape and access pattern actually fits your problem.
Hierarchical, Network, and Cloud Databases
Hierarchical databases, like IBM's IMS, use a tree structure where each record has exactly one parent, similar to folders containing subfolders. Network databases extended this hierarchical database model to allow multiple parents per record. Both are largely legacy today, but understanding them helps explain why the relational model was such a breakthrough when E.F. Codd proposed it in 1970.
Cloud databases aren't a separate data model at all, they're a deployment model. Common cloud database examples like Amazon RDS, Google Cloud SQL, and Azure SQL Database let you run MySQL or PostgreSQL with automatic backups, managed updates, and elastic scaling, without managing physical servers yourself.
Visual Summary
Picture a central box labeled Database Types branching into five categories: Relational (MySQL, PostgreSQL — tables and SQL), NoSQL (MongoDB, Redis, Cassandra, Neo4j — document, key-value, column-family, and graph), Hierarchical (IBM IMS — tree structure), Network (IDMS — multi-parent tree), and Cloud (Amazon RDS, Azure SQL — a managed layer over any of the above).
Database Types at a Glance
| Database Type | Data Model | Best Use Case | Real Examples | SQL Used? |
|---|---|---|---|---|
| Relational | Tables and rows | Business apps, transactions, reports | MySQL, PostgreSQL, Oracle | Yes |
| Document (NoSQL) | JSON documents | Product catalogs, CMS, user profiles | MongoDB, Firestore | No (own query API) |
| Key-Value (NoSQL) | Key → Value pairs | Caching, sessions, leaderboards | Redis, DynamoDB | No |
| Column-family (NoSQL) | Column families | IoT, logging, time-series at scale | Cassandra, HBase | No |
| Graph (NoSQL) | Nodes and edges | Social networks, fraud detection | Neo4j, Amazon Neptune | No |
| Hierarchical | Parent-child tree | File systems, legacy enterprise systems | IBM IMS | Limited |
| Cloud (managed) | Varies by engine | Reduced operations overhead | Amazon RDS, Azure SQL | Depends on engine |
SQL Example
-- Relational database example: E-commerce product catalog
-- In a relational model, products and categories are connected through a foreign key
CREATE TABLE categories (
category_id INT PRIMARY KEY AUTO_INCREMENT,
category_name VARCHAR(100) NOT NULL UNIQUE
);
CREATE TABLE products (
product_id INT PRIMARY KEY AUTO_INCREMENT,
product_name VARCHAR(150) NOT NULL,
price DECIMAL(10,2) NOT NULL CHECK (price > 0),
stock_qty INT DEFAULT 0,
category_id INT,
FOREIGN KEY (category_id) REFERENCES categories(category_id)
);
-- Find products in the 'Electronics' category under Rs 5000
SELECT p.product_name, p.price, p.stock_qty
FROM products p
JOIN categories c ON c.category_id = p.category_id
WHERE c.category_name = 'Electronics'
AND p.price < 5000
AND p.stock_qty > 0
ORDER BY p.price ASC;
Categories are stored once in their own table, and products reference them with a foreign key. A document database like MongoDB could store this too, but the relational model makes it easy to enforce category integrity, so a product can never be assigned to a category that doesn't exist.
Real-World Examples
- Swiggy and Zomato run core operational data such as orders and payments on relational databases, while using Redis for real-time delivery tracking and caching.
- LinkedIn uses a graph database to power "People You May Know," since social connections naturally form a graph of people and connections.
- Uber stores ride events and driver telemetry in column-family databases like Cassandra, built for extremely high write volume and time-range scans.
- Twitter and Instagram use key-value stores like Redis for session tokens and timeline caches, delivering sub-millisecond response times.
Best Practices and Pro Tips
- Don't pick a database type because it's trendy — pick it because your data's actual shape and access pattern matches it. A flexible document store doesn't help if your data is genuinely tabular and relational.
- It's normal, not exotic, for one production system to use several database types at once — MySQL for orders, Redis for sessions, and Elasticsearch for search is a common real-world combination.
- If you're choosing your first database to learn, relational SQL skills transfer the most: tables, keys, and JOINs shape how you'll reason about NoSQL data modeling later too.
Common Mistakes to Avoid
- Assuming NoSQL means no structure at all — document and column-family databases have their own schemas and query languages, just not a rigid relational one.
- Choosing NoSQL because it sounds modern rather than because your data shape and consistency needs actually call for it.
- Thinking a cloud database is a different data model — it's a deployment model, not a new way of structuring data.
Interview Questions
Q1. What are the main types of databases and when would you choose each?
Relational databases like MySQL suit structured business data needing transactions and SQL queries. Document databases like MongoDB suit flexible or nested data. Key-value stores like Redis are ideal for caching. Graph databases like Neo4j excel at connected data like social networks.
Q2. Is NoSQL better than SQL for all modern applications?
No. Relational databases remain the dominant choice for structured business data and ACID transactions. Many large applications combine both, for example transactional data in MySQL with a session cache in Redis.
Q3. What is a cloud database and what are its advantages?
A cloud database is a database service hosted and managed on infrastructure like AWS, Google Cloud, or Azure, offering automatic backups, auto-scaling, high availability, and managed updates without server provisioning.
Practice MCQs
1. Which database type stores data in tables and uses SQL?
- Document (NoSQL)
- Relational
- Graph
- Key-value
Answer: B. Relational
Explanation: Relational databases store data in rows and columns and are queried using Structured Query Language (SQL).
2. Redis is primarily an example of which database type?
- Relational
- Column-family
- Key-value store
- Graph
Answer: C. Key-value store
Explanation: Redis stores data as key-value pairs and is optimized for extremely fast in-memory lookups.
3. Which database type is best suited for storing a social network's friendship connections?
- Relational
- Key-value
- Column-family
- Graph
Answer: D. Graph
Explanation: Graph databases model data as nodes and edges, making them natural for social connections, recommendations, and fraud detection.
Quick Revision Points
- Relational databases use tables, SQL, and ACID transactions — examples: MySQL, PostgreSQL, Oracle.
- NoSQL subtypes: Document (MongoDB), Key-value (Redis), Column-family (Cassandra), Graph (Neo4j).
- Hierarchical databases use a parent-child tree; network databases allow multiple parents.
- Cloud databases are managed deployment models, not a separate data model.
Conclusion
- Different database types solve different problems — no single database wins every scenario.
- Relational databases remain the most important for SQL learners, since they dominate business use and interviews.
- Many real production systems combine database types, like MySQL for transactions and Redis for caching.
Database types evolved to serve different data needs: relational databases power structured business applications with SQL and referential integrity, NoSQL databases serve flexible or high-scale workloads, and cloud databases bring managed infrastructure to any of them. In any sql vs nosql comparison, the honest answer is that the right database type depends entirely on your data's shape and access pattern, and as a SQL learner, you're mastering the type still used most widely in business, finance, and enterprise applications worldwide.