What is a database?

A database is an organized collection of data stored electronically so it can be easily accessed, managed, and updated. Software called a database management system (DBMS) controls the database, handling security, backups, multi-user access, and queries.

PostgreSQL, MySQL, SQLite, and MongoDB are examples of DBMS software.

On this page

Types of Databases

Six database models illustrated as a relational table, a JSON-like document, key-value pairs, a wide-column row with column families, a graph with nodes and an edge, and vectors with numerical values. Download image

1. Relational Database (SQL)

Stores data in structured tables with rows and columns. A defined schema and constraints help maintain data integrity. Relational databases work well for complex queries and transactions, such as recording a bank transfer. Examples include PostgreSQL and MySQL.

2. Document Store (NoSQL)

Stores data in flexible, JSON-like documents. Documents can have different fields, so you can add fields as your application grows. Some systems also let you validate document fields. Examples include MongoDB and Cloud Firestore from Firebase.

3. Key-Value Store (NoSQL)

Stores data as pairs of unique keys and their corresponding values, like a dictionary. Fast lookup by key makes this model useful for API response caching and user sessions. Redis is an example. Memcached uses the same model as an in-memory cache.

4. Wide-Column Store (NoSQL)

Stores data in rows identified by keys. A system such as HBase groups related columns into column families. Wide-column stores can distribute large volumes of data across servers and are used for applications such as high-volume logs, IoT telemetry, and large-scale analytics. Examples include Apache Cassandra and Apache HBase.

5. Graph Database (NoSQL)

Stores entities as nodes and their relationships as edges. Graph databases make it efficient to follow multiple connections, such as finding mutual friends or generating recommendations. Neo4j is an example.

6. Vector Database (NoSQL / AI)

Stores and indexes embeddings, which are high-dimensional vectors that represent data such as text or images. Vector databases use similarity search to find related content and can retrieve relevant documents for Retrieval-Augmented Generation (RAG). Examples include Pinecone and Milvus.

Related lessons

Official references