5 min read6 sourcesUpdated

What Is a Database? Tables, Queries, SQL vs NoSQL

What a database is, how tables and queries work, SQL versus NoSQL, and how it differs from a spreadsheet.

TL;DR

  • A database is an organised collection of data, managed by software called a database management system (DBMS), so that data can be stored, found and updated reliably.
  • Relational databases keep data in tables of rows and columns and are queried with SQL. NoSQL databases use other formats, such as documents or key-value pairs.
  • A database differs from a spreadsheet in size, shared access and rules, and from a peer-to-peer network, which is a way computers connect rather than a way data is organised.

What a database is #

A database is an organised collection of data, usually run by a database management system (DBMS). The DBMS is the software that lets people and apps store, retrieve and update data, and it typically also deals with security, many users at once, backups and rules about what data is allowed [1]. PostgreSQL, MySQL, SQLite and Microsoft SQL Server are well-known examples [1].

Databases are everywhere. Library catalogues, flight booking systems, stock lists and customer records all sit in databases [1]. When you log in to a website, it usually looks you up in one.

A good analogy is a filing cabinet with a very fast, very strict clerk. You ask for what you want, and the clerk finds it, adds to it, or changes it, and refuses anything that breaks the rules.

Tables and queries #

In a relational database, data lives in tables. A table is a named collection of rows. Each row is one record, and each column has a name and a specific data type, such as text or number [2]. Tables can be linked to each other through shared keys, which is where the word "relational" comes from [1].

To get data out, you write a query. Most relational databases use SQL (Structured Query Language), the standard language for defining structures, adding and changing data, and asking questions about it [1]. For example, a query like SELECT name FROM pets WHERE kind = 'cat' asks for the names of all cats in a table called pets. One thing to know: rows have no guaranteed order unless the query asks for a sort [2].

A small table of pets with a SQL query above it; the two rows where the kind is cat are highlighted and a result box below lists Mia and Kit
A query picks out the matching rows from a table. Here, the cats. (tap or click the image to open it full size)

SQL vs NoSQL #

NoSQL means "not only SQL". It covers databases that store data in forms other than relational tables [3]. The main kinds are:

TypeStoresGood for
DocumentJSON-like documentsFlexible records, such as user profiles [3]
Key-valueOne value per unique keyFast lookups, caching, sessions [3]
Wide-columnRows with varying columnsVery large, spread-out data sets [3]
GraphNodes and links between themHighly connected data [3]

The practical differences are these. Relational databases have a fixed layout, where every row has the same columns. NoSQL databases are usually more flexible, and records can differ from each other [3]. NoSQL systems are often designed to spread data over many machines [1][3]. Neither is "better": the right choice depends on how structured your data is, how much of it there is, and how it will be used. Many real systems use both.

How it differs from a spreadsheet, and from peer-to-peer #

Spreadsheet. A spreadsheet suits analysis and small data sets. Any cell can hold anything, whereas database fields have a preset type and wrong entries are rejected [4]. Spreadsheets are limited in size, and each person often edits their own copy, while in a database one change is visible to everyone [4]. Databases also cut down on duplicate entries, so an update made once applies everywhere [4].

Peer-to-peer. These are different kinds of things. A database is about how data is organised and queried. Peer-to-peer is about how computers are arranged: peers share resources directly, without a central provider [5]. A database can run on one laptop as a single file [6], or on a central database server that many applications connect to [6]. Some databases are spread over several machines, but that is a design choice for the database, not the same as a file-sharing network.

FAQ #

Is a database the same as SQL? #

No. SQL is a language used to talk to relational databases. The database is the stored data and the software that manages it [1].

What is the difference between a database and a spreadsheet? #

A spreadsheet is built for calculating and presenting numbers, usually by one person. A database is built to store large, connected data safely for many users and apps at once [4].

Which database type should a beginner learn first? #

Most courses start with a relational database and SQL, because tables and queries are the common foundation. NoSQL concepts are easier to pick up afterwards.

Where is a database actually stored? #

It can be a single file on one device or a service running on one or many servers, including in the cloud [1][6].

Sources #

All sources accessed 2026-10-27.

  1. Database. Wikipedia. https://en.wikipedia.org/wiki/Database
  2. Concepts: relational database tables, rows and columns. PostgreSQL Documentation. https://www.postgresql.org/docs/current/tutorial-concepts.html
  3. What is NoSQL? MongoDB. https://www.mongodb.com/resources/basics/databases/nosql-explained
  4. Database vs Spreadsheet: What's the Difference? 365 Data Science. https://365datascience.com/tutorials/sql-tutorials/database-vs-spreadsheet/
  5. Peer-to-peer. Wikipedia. https://en.wikipedia.org/wiki/Peer-to-peer
  6. Appropriate Uses For SQLite. SQLite documentation. https://www.sqlite.org/whentouse.html