Database Fundamentals

Published: (January 31, 2026 at 06:16 AM EST)
4 min read
Source: Dev.to

Source: Dev.to

Why Data Is Important

What Are Databases?

What Makes a Good Database?

Different Types of Databases

Relational Databases Explained

What Is DBMS?

What Does DBMS Do?

Understanding Database Keys

Relationships Between Data

Problems with Databases

A Simple Analogy

Think of a database as a smart filing cabinet that stores information in an organized way.

Simple Definition:
A database is a place where we keep related information together so everyone in a company can use it easily.

Core Benefits

1. Store Lots of Information

Instead of keeping data in many Excel files or paper documents, you can put everything in one place and easily search for what you need.

2. Analyze Your Data

Ask questions like “How many customers bought products last month?” and get answers quickly. Create reports to understand your business better.

3. Keep Track of Records

Need to remember who paid you, what items are in your store, or customer phone numbers? A database keeps all this safe and organized.

4. Run Websites and Apps

Every time you use Facebook, Amazon, or any app, a database works behind the scenes to show you the right information.

5. Everyday Notebook Analogy

Imagine you have a notebook where you write:

  • Names of your friends
  • Their phone numbers
  • Their birthdays

A database is like that notebook, but on a computer: it’s organized, searchable in a flash, and many people can use it at the same time.

5 Essential Qualities of a Good Database

#QualityWhat It Means
1Integrity (Correctness)Information must be accurate (e.g., age = 25, not 250).
2Availability (Always Ready)Data should be accessible whenever you need it – 24/7.
3Security (Protected)Only authorized people can see or change the data.
4Independent of Application (Flexible)Works with any program (like a USB drive works with any computer).
5Concurrency (Multi‑user)Many users can access the data simultaneously without conflicts.

Types of Databases

Just like there are different vehicles (car, bike, truck) for different needs, there are different types of databases.

TypeDescriptionTypical Use‑CasesExamples
Relational Databases (SQL)Tables with rows & columns, similar to Excel spreadsheets.Most common applications.MySQL, PostgreSQL, Oracle
NoSQL DatabasesStore “messy” data such as photos, videos, social‑media posts, documents.Big data, flexible schemas.MongoDB (used by Uber, eBay)
Column DatabasesStore data column‑by‑column rather than row‑by‑row; great for analytics on huge datasets.Data warehousing, analytics.Google BigQuery, Amazon Redshift
Graph DatabasesModel relationships between entities (e.g., friends on Facebook, recommendations on Netflix).Social networks, recommendation engines.Neo4j, Amazon Neptune
Key‑Value DatabasesSimple dictionary‑style storage: a key maps to a value.Caching, session storage.Redis, DynamoDB

Which one to pick?
It depends on what you’re building. For most beginner projects, start with a Relational Database.

Relational Databases – A Deeper Look

Think of a relational database as multiple Excel sheets that are related to each other.

SheetContent
Sheet 1Student names and their ID numbers
Sheet 2Class names and which students are in them

Both sheets use student IDs, so they are related.

How It Maps to Database Terms

  • Tables = Excel sheets
  • Rows = Each line of information (e.g., one student)
  • Columns = Types of information (e.g., name, age, email)

DBMS – Database Management System

Analogy:

  • Database = Library (where books are stored)
  • DBMS = Librarian (helps you find, add, or remove books)
  • MySQL
  • PostgreSQL
  • Oracle
  • Microsoft SQL Server

What a DBMS Does

  1. Data Management – Save, retrieve, and modify information.
  2. Keeps Data Accurate (Integrity) – Prevents invalid entries (e.g., “ABC” as an age).
  3. Multi‑user Access (Concurrency) – Allows many users to work simultaneously without conflicts.
  4. Transactions – Guarantees operations are all‑or‑nothing (e.g., money transfers).
  5. Security – Enforces authentication and authorization.
  6. Utilities – Backup, import/export, user management, etc.

Keys – Identifying Data

A key is a unique identifier for each piece of information in a table.

Key TypeDefinitionExample
Super KeyAny combination of columns that uniquely identifies a row.RollNumber + Name
Candidate KeyMinimal set of columns that can uniquely identify a row.RollNumber
Primary KeyThe chosen candidate key; the main identifier for a table.RollNumber (must be unique, not null, only one per table)
Alternate KeyOther candidate keys not selected as the primary key.Email (if RollNumber is primary)
Composite KeyTwo or more columns together uniquely identify a row.Class + SeatNumber
Surrogate KeyArtificial identifier generated when no natural key exists.Auto‑generated IDs like CUST001, CUST002
Foreign KeyA key from another table used to create a relationship between tables.StudentID in an Enrollments table referencing Students table

Real‑Life Analogy

  • Key: Your Aadhaar card number – unique to you.
  • Super Key: Aadhaar + Phone + Email (any combination that’s unique).
  • Candidate Key: Aadhaar alone (the smallest unique identifier).
  • Primary Key: The Aadhaar number you decide to use as the main ID.

Summary

  • Databases store, organize, and protect data so it can be accessed efficiently, analyzed, and shared across applications and users.
Back to Blog

Related posts

Read more »

SPRING BOOT EXCEPTION HANDLING

Java & Spring Boot Exception Handling Notes 1. What is Exception? Exception = unwanted situation that breaks normal flow of program. Goal of exception handling...