MainExamplesHistoryRecommended Reading
Explain /Databases

What is a Database?

Help others learn from this page

A database is an organized collection of data stored electronically. Think of it like a digital filing cabinet that's incredibly fast at finding, organizing, and managing information.

Why We Need Databases:

  • Persistence: Data survives after your program closes
  • Organization: Structured storage with relationships
  • Efficiency: Fast queries and updates
  • Concurrency: Multiple users can access data safely
  • Integrity: Rules ensure data stays consistent

Types of Databases:

  • Relational (SQL): Data in tables with relationships (MySQL, PostgreSQL)
  • NoSQL: Flexible schemas (MongoDB, Redis)
  • Graph: For connected data (Neo4j)
  • Time-series: For metrics and logs (InfluxDB)

Key Concepts:

  • Tables/Collections: Where data is stored
  • Queries: How you ask for data
  • Transactions: Groups of operations that succeed or fail together
  • Indexes: Structures that speed up lookups

FAQ

What's the difference between SQL and NoSQL?
SQL databases use structured tables and relationships. NoSQL databases are more flexible, using documents, key-value pairs, or graphs.
Do I need a database for my app?
If you need to store data that persists between sessions, yes. Simple apps might use files, but databases are better for complex data.
What's a database transaction?
A group of operations that either all succeed or all fail. Like transferring money: both accounts must update, or neither does.

Enjoyed this explanation? Share it!

Promote your content

Reach over 400,000 developers and grow your brand.

Join our developer community

Hang out with over 4,500 developers and share your knowledge.