Tutorials SQL What is a Database?
Ch 9 / 78
Advertisement
📢 Ad space · 728 × 90 · Replace slot ID above
Chapter 2 Beginner 7 min read SQL

What is a Database?

Before you write a single SQL query, you need to understand what a database actually is and why applications use them. In this chapter we'll use everyday analogies — like a library and a spreadsheet — to make the concept click instantly, then explore the different types of databases powering the modern world.

What you'll learn
What a database is in plain English
How data is organised into tables, rows and columns
What a DBMS is and why it matters
The 6 main types of databases explained
Real-world apps that use databases every day
Why SQL databases are the most widely used

What is a Database?

A database is an organised collection of data stored electronically so it can be easily accessed, managed, and updated. Think of it like a very smart, very fast filing cabinet — except instead of paper folders, data is stored in structured tables that a computer can search through in milliseconds.

Every app you use daily — Instagram, Google Maps, your bank's mobile app, Amazon — has one or more databases quietly storing your data behind the scenes.

Library
Books are organised by category, author, and title so you can find any book instantly
Spreadsheet
Data lives in rows and columns — a database is like multiple smart spreadsheets linked together
Filing Cabinet
Records are stored in labelled folders — you can retrieve any file without reading everything
Phonebook
Names, numbers, and addresses in a structured list — lookup any contact by name instantly
Simple Definition
Database = an organised place to store data so it can be retrieved quickly, updated safely, and shared across multiple users or applications at the same time.

Why Not Just Use Files or Spreadsheets?

A common beginner question is: "Can't I just save everything in an Excel file or a text file?" — For 10 records, yes. But real applications need much more. Here's how files compare to a proper database:

Files / Spreadsheets
  • Only one person can edit at a time
  • No protection against duplicate or bad data
  • Searching 100,000 rows is painfully slow
  • No user permissions — everyone sees everything
  • Hard to link related data across sheets
  • Data can get corrupted if file is open by two people
VS
Database
  • Thousands of users can read/write simultaneously
  • Constraints enforce data accuracy automatically
  • Indexes find records in millions of rows in <1 ms
  • Role-based access control per table or column
  • Tables link via keys — no data duplication needed
  • Transactions guarantee data stays consistent
Real-world scale
Facebook stores over 100 petabytes of data. Amazon processes millions of orders per day. Google indexes 100 billion web pages. None of this would be possible with files — it all runs on databases.

How Data is Stored — Tables, Rows & Columns

In a relational database (the most common type), data is stored in tables. Each table represents one type of thing — for example, customers, orders, or products. A table is made up of:

Columns (Fields)
The categories of information stored — e.g. id, name, email, city. Each column has a data type (text, number, date, etc.) that it always holds.
Rows (Records)
Each row is one individual entry in the table — e.g. one specific customer. A table with 50,000 customers has 50,000 rows.
Primary Key
A special column (or set of columns) that uniquely identifies every row. No two rows can have the same primary key value. Usually a number like customer_id.
Cell
The intersection of a row and a column — holds a single piece of data, e.g. 'Priya Sharma' in the name column of row 1.
A sample "customers" database table
customers
customer_id name email city joined_date
1 Priya Sharma priya@mail.com Vadodara 2023-01-15
2 Rahul Patel rahul@mail.com Surat 2023-03-22
3 Anika Desai anika@mail.com Ahmedabad 2023-07-10
4 Kiran Mehta kiran@mail.com Vadodara 2024-01-05
4 rows (records) — one per customer 5 columns (fields) — categories of info customer_id = Primary Key — unique per row
Advertisement
📢 Ad space · 728 × 90 · Replace slot ID above
📊
Free Resource
Download our SQL Cheat Sheet
All essential commands, clauses and functions — one printable page.
Get Sheet

What is a DBMS?

The data itself (the tables and rows) is the database. The software that manages that data — letting you store, retrieve, update, and secure it — is called a DBMS (Database Management System).

Think of it this way: the database is the warehouse full of boxes. The DBMS is the warehouse manager who knows where every box is, controls who can enter, and keeps the inventory organised.

Database
The actual stored data
  • A collection of tables, rows, and columns
  • Stores all your application's data on disk
  • Organised logically by schema (structure)
  • Exists even when no software is running
DBMS
The software that manages the database
  • Accepts SQL queries from users and apps
  • Finds and returns data efficiently (using indexes)
  • Enforces constraints, security, and backups
  • Examples: MySQL, PostgreSQL, SQLite, Oracle
How a DBMS sits between your app and the data
You / Application
Sends an SQL query
↓
Application Layer
Website, mobile app, API
↓
DBMS
MySQL / PostgreSQL / SQLite — parses, optimises, executes
↓
Physical Storage
Data on disk / SSD / cloud
↓
Results returned to you
Rows of data, displayed instantly

Types of Databases

Not all databases work the same way. Over the years, different types have been created for different use cases. Here are the 6 main categories you'll encounter as a developer or data professional:

Relational Database
Most Common
Data is stored in tables with rows and columns. Tables can be linked together using keys. You query it with SQL. This is what this entire tutorial is about.
Examples: MySQL PostgreSQL SQLite Oracle
NoSQL / Document Database
Flexible Schema
Stores data as JSON-like documents instead of fixed tables. Great for unstructured or rapidly-changing data. No strict schema required — each document can have different fields.
Examples: MongoDB Firestore CouchDB
Time-Series Database
IoT / Metrics
Optimised for data that changes over time — sensor readings, stock prices, server metrics, logs. Extremely fast at querying data by time range.
Examples: InfluxDB TimescaleDB Prometheus
Graph Database
Relationships
Stores data as nodes and edges (like a network). Perfect for social networks, recommendation engines, and fraud detection where connections between data matter most.
Examples: Neo4j Amazon Neptune ArangoDB
In-Memory / Cache Database
Ultra-Fast
Stores data in RAM instead of disk — reads are 1000× faster. Used for caching frequently-accessed data like user sessions, leaderboards, and API rate limits.
Examples: Redis Memcached DragonflyDB
Which should you learn first?
Start with a Relational Database + SQL. It is the foundation of data management and the most in-demand skill. Once you understand SQL deeply, picking up MongoDB or Redis becomes much easier — because you already understand how data is structured and queried.
Advertisement
📢 Ad space · 728 × 90 · Replace slot ID above

Real-World Apps & Their Databases

Every application you use every day is powered by one or more databases working in the background. Here's a glimpse at how real companies store their data:

Application What data is stored Database type used
Amazon / Flipkart Products, customers, orders, inventory, prices Relational (Aurora / MySQL) + NoSQL (DynamoDB)
Instagram User profiles, photos, likes, follows, comments Relational (PostgreSQL) + Cache (Cassandra, Redis)
HDFC / SBI Bank Accounts, transactions, loans, interest rates Relational (Oracle / SQL Server) — ACID critical
Netflix User watch history, content catalog, recommendations Relational + NoSQL (Cassandra) + In-Memory (EVCache)
Google Maps Location data, routes, businesses, reviews, traffic Relational + Graph + Spatial databases
School / College ERP Students, courses, marks, attendance, fees Relational (MySQL / PostgreSQL)
Analytics Dashboard Clicks, events, page views, user behaviour over time Time-series + Cloud warehouse (BigQuery / Snowflake)

How You Work with a Database — Step by Step

As a developer or analyst, here's the typical journey from your idea to the data:

1
Design the Schema
Decide which tables you need, what columns they have, and how they relate to each other. This is called the database schema — the blueprint of your data. E.g: customers, orders, products.
2
Create the Database & Tables
Use SQL CREATE DATABASE and CREATE TABLE statements to set up the structure — define column names, data types, and constraints like PRIMARY KEY and NOT NULL.
3
Insert Data
Add records using INSERT INTO. Your application sends new rows whenever a user signs up, places an order, or creates any new record.
4
Query the Data
Use SELECT to read data. Add WHERE to filter, ORDER BY to sort, JOIN to combine tables. This is where you'll spend 80% of your SQL time.
5
Update & Delete Records
Modify existing data with UPDATE and remove rows with DELETE. Always use a WHERE clause here — without it, you'd change or delete every row!
6
Maintain & Optimise
As data grows, add indexes to speed up slow queries, set up backups for disaster recovery, and control access with GRANT / REVOKE permissions for different users or roles.

In the next chapters you'll learn each of these steps in detail. As a quick preview, here's what querying a database looks like with SQL:

SQL — Reading data from a database
SELECT  name, email, city
FROM    customers
WHERE   city = 'Vadodara'
ORDER BY name ASC;
SELECT name, email, city
Choose which columns to return — we only want the name, email, and city fields.
FROM customers
Tell the database which table to look in — our customers table.
WHERE city = 'Vadodara'
Filter rows — only include customers whose city is Vadodara.
ORDER BY name ASC
Sort the results alphabetically by name (A → Z).
Common Confusion
People often use the words "database" and "DBMS" interchangeably in everyday conversation — and that's fine. Just remember: technically the database is the data, and the DBMS (MySQL, PostgreSQL, etc.) is the software that manages it.
Quick Check — Chapter 2

Which of the following best describes a DBMS?

Chapter Summary
  • A database is an organised collection of data stored electronically — like a smart, fast, multi-user filing cabinet.
  • Databases are far superior to files and spreadsheets for real-world apps — they handle concurrent users, enforce data integrity, and search millions of rows in milliseconds.
  • In a relational database, data is organised into tables (rows + columns). Each table has a primary key that uniquely identifies every row.
  • A DBMS (Database Management System) is the software — like MySQL or PostgreSQL — that manages the database, executes queries, and controls access.
  • There are 6 main types of databases: Relational, NoSQL/Document, Time-Series, Graph, In-Memory, and Search.
  • For beginners: always start with Relational databases + SQL — it's the most widely used, most in-demand, and easiest to understand first.
Advertisement
📢 Ad space · 728 × 90 · Replace slot ID above

Rate Us on Google

4.8 / 5
Enjoying this tutorial?
Your 5-star review helps other learners discover our free tutorials and encourages us to keep creating quality content.
80+ reviews
Write a Google Review
Join WhatsApp Channel