coldwa.st
All guidesProgrammingWebDataToolsDatabasesHaskellConceptsCabal & buildsToolchainCompilerPerformanceEditor & HLS

Programming · data · databases

What is a database?

By ColdwastUpdated Jun 15, 20267 min read#database#data#concepts
Racks of servers in a data center
Racks of servers in a data center — databases run on servers like these, storing the data behind apps and websites.

Every app you use — your bank, a shop, a social feed — keeps its information somewhere it can be found, changed and trusted. That somewhere is a database. It is one of the foundational ideas in software. This guide explains what a database is, the main types, the concepts that matter, real examples, and how it connects to SQL.

The short definition

A database is an organised collection of data, managed by software (a database management system, or DBMS) that lets you store, retrieve, update and protect that data reliably. A spreadsheet can hold data too, but a database adds structure, fast querying at scale, multi-user access, and guarantees that the data stays consistent even when many things change at once.

Database vs DBMS

Two words get used interchangeably but mean different things. The database is the data itself and how it's organised. The DBMS — PostgreSQL, MySQL, SQLite, MongoDB — is the software that stores it, runs your queries, enforces rules and handles concurrent access. When people say "which database should I use?" they usually mean which DBMS.

The two big families

  • Relational (SQL) databases organise data into tables of rows and columns, with defined relationships between them, and you query them with SQL. They excel at structured data and guaranteed consistency. Examples: PostgreSQL, MySQL, SQLite, SQL Server.
  • NoSQL databases relax the rigid table structure for flexibility and scale. They come in flavours: document stores (MongoDB), key-value stores (Redis), wide-column (Cassandra) and graph databases (Neo4j). Useful for huge volumes, fast caching, or data whose shape changes often.

Most real systems use more than one — for example a relational database for core records and a key-value store for caching.

A laptop showing a data dashboard with charts
A data dashboard — the numbers and charts in an app are read from a database underneath, usually with a query.

The key concepts

  • Schema — the defined structure: which tables exist, their columns and types, and the rules. Relational databases are schema-first; many NoSQL ones are flexible.
  • Query — a request for specific data ("all orders from last week"). In relational databases you write these in SQL.
  • Index — a lookup structure that makes queries fast by avoiding a scan of every row, like the index at the back of a book.
  • Transaction — a group of changes that must all succeed or all fail together (moving money between two accounts). Relational databases guarantee this with ACID properties.

What ACID means

ACID describes the guarantees a reliable database gives a transaction: Atomicity (all-or-nothing), Consistency (the data obeys its rules before and after), Isolation (concurrent transactions don't corrupt each other) and Durability (once committed, the change survives a crash). These guarantees are why you trust a database with money and records rather than a plain file.

Why databases matter

They let software store data once and use it everywhere, safely, at scale, with many users at the same time — and find any slice of it in milliseconds. Almost every non-trivial program eventually needs one. The skill of choosing the right type and querying it well is among the most durable in software.

The honest trade-offs

There's no universally "best" database. Relational databases give strong consistency and powerful queries but need a defined schema; NoSQL gives flexibility and horizontal scale but often trades away some consistency guarantees. The right choice depends on your data's shape, your scale, and how much you value strict consistency versus flexibility. Many teams combine both.

FAQ

Is a database the same as SQL? No. A database stores data; SQL is the language used to query relational databases. NoSQL databases use other query methods.

Is a spreadsheet a database? Loosely, but not really. A spreadsheet holds data, but a database adds enforced structure, fast querying at scale, multi-user safety and transactional guarantees that a spreadsheet lacks.

What is the difference between SQL and NoSQL? SQL/relational databases use structured tables and strong consistency; NoSQL databases relax structure for flexibility and scale. Neither replaces the other — they suit different jobs.

Which database should a beginner learn first? A relational one — SQLite or PostgreSQL — because the relational model and SQL transfer everywhere and teach the core ideas clearly.

To query a relational database, you'll use SQL; the data a database returns to an app often travels as JSON. Browse more clear explainers in our guides index.

Independent, community-maintained guide. coldwa.st is a programming-resources site; this article is new, original explanatory writing about databases. Examples reflect widely-used systems; verify specifics against each system's documentation.