What Is a Database?

A database is an organized collection of information that you can search and update. An online shop, for example, uses a database to remember who bought an item and where to send it.

Follow an order to its customer

Each row holds one record. A column holds one kind of information, such as the city for each customer.

Orders
order_idcustomer_idItem
501101Notebook
502102Pen
503101Pencil
Customers
customer_idNameCity
101MayaBoston
102LuisAustin
103NoorSeattle

Five types of databases

Each model organizes information differently. Choose based on the data and how the app needs to retrieve it.

Relational

Tables with rows, columns and keys. An online shop with orders linked to customers.

Document

Records grouped as documents, often with nested fields. A product catalog where shoes have sizes and laptops have memory specs.

Key-value

Each unique key retrieves a value. A session ID used to retrieve a shopper’s cart.

Graph

Nodes and edges represent things and their relationships. A travel app that traces connections between stations.

Vector

Numeric vectors can be searched for similarity. A help center that retrieves similar articles by meaning.

SQL vs NoSQL

People often call relational systems like PostgreSQL “SQL databases.” NoSQL is an umbrella term for several other models, so features vary by product.

FeatureSQLNoSQL
Data modelRows in related tables.Depends on the system, such as documents, key-value pairs or graphs.
QueriesSQL supports filtering, aggregation and joins.APIs and query languages depend on the system. Some offer SQL-like query syntax.
Good fitOrder records with consistent fields and relationships.A catalog with different attributes for different product types.

Database or spreadsheet?

A spreadsheet is good for editing a small list, making a budget or charting numbers. Use a database when an app must enforce record rules, connect multiple collections and handle simultaneous updates reliably.

Database basics quiz

Try six questions and check your answers.

1. What does one row in Customers describe?
2. What makes customer_id a primary key in Customers?
3. Why can two orders share customer_id 101?
4. Which operation combines the Orders and Customers rows on a matching ID?
5. Which model represents people and their friendships as nodes and connections?
6. Which task makes a database a better fit than a small personal spreadsheet?

How to follow a database relationship

  1. Inspect rows and columns. Compare one order with the fields that every order has.
  2. Find the keys. Select Primary keys and Foreign keys to see which fields identify records and which link tables.
  3. Run a sample lookup. Select Join the tables, then pick an order to see its matching customer and example SQL.
Back to the sample lookup

Database questions, answered

What is a database in simple terms?

A database is an organized collection of information. An app can search, add or update that information using database software.

What is an example of a database?

An online shop can store customers, products and orders in a database. An order can use a customer ID to connect to the right customer record.

What is the difference between a primary key and a foreign key?

A primary key identifies a row in its own table. A foreign key references a key in another table, or sometimes in the same table, and the database can enforce that the referenced row exists.

Is SQL a database?

SQL is a language for working with data. PostgreSQL and SQLite are examples of database systems that use SQL.

Are databases always stored in tables?

Relational databases organize data into tables. Other models can organize information as documents, key-value pairs, graphs or vectors.

For more examples, see the PostgreSQL joins tutorial and MongoDB’s NoSQL overview.

Run the same data checks or reports every week? Explore Tornic to turn those steps into a repeatable workflow.