Database Introduction
A database is a system that stores information in an organized way so you can easily find, change, and manage it. It keeps your data safe, prevents mistakes, and allows many people or programs to use the data at once. We use databases in apps, websites, banking, shopping, and even social media.
Why Did We Need Databases?
Before databases, we had serious problems:
- Duplicate data in many places (called redundancy) caused confusion.
- Inconsistent data—one place was updated but others weren’t.
- Slow searches—you had to go through everything manually.
- Hard to grow—old systems didn’t scale well as data increased.
- No teamwork—only one person could update data at a time.
- Weak security—it was hard to control who accessed what.
How Did We Manage Data Before?
Paper-Based Systems (Before 1950s)
- Used books, paper files, and manual processes.
- Slow, prone to mistakes, and not shareable easily.
File-Based Systems (1950s–1960s)
- Started using computers to store data in files (like text files).
- Data was stored, but not very smartly—no indexes or structure.
- Programming was done with COBOL and assembly code.
Hierarchical & Network Databases (1960s–1970s)
- IBM made a database called IMS that stored data in a tree-like format.
- CODASYL group created complex networks of data relationships.
- These systems were better but very rigid—you couldn’t change things easily.
The Big Shift: Relational Databases (1970s–1980s)
- Dr. Edgar F. Codd (IBM) had a new idea: organize data in tables and link them using relationships.
- Introduced SQL (Structured Query Language) so you could manage data without needing deep programming skills.
- Popular systems like Oracle, IBM DB2, and Microsoft SQL Server were created.
Modern Databases (1990s–Now)
- Object-Oriented Databases (OODBMS):
- Useful for storing complex data like multimedia or objects used in code.
- NoSQL Databases (2000s–Present)
- Handle big data, flexible data types, and work across many servers.
- Examples: MongoDB, Cassandra.
- Cloud and AI Databases:
- Databases now live in the cloud (like AWS, Azure).
- AI helps optimize queries and automate backups or scaling.
Types of Databases
We'll focus on Relational Databases, especially IBM DB2, since it is widely used in enterprise systems and supports critical business applications with strong consistency and structure.
Introduction
Databases come in different types, each with its own way of organizing and managing data. The three main types are:
- Relational Databases (SQL)
- Non-Relational Databases (NoSQL)
- Hierarchical Databases
Each type works best for specific tasks, depending on how structured the data is, how fast it needs to be accessed, and how large or complex the system is.
Hierarchical Databases
These databases store data in a tree-like structure. One record (the parent) can have many child records, but each child has only one parent.
Key Features
- Uses a one-to-many structure, like a family tree.
- Very fast for data with clear parent-child relationships.
- Doesn’t use SQL; you navigate from top to bottom.
- Structure is fixed—so it's hard to change later.
Common Uses
- Storing system settings (e.g., Windows Registry).
- Organizational charts in HR systems.
- Geographic data (maps, location-based info).
- Older banking systems on mainframes.
[!Example] IBM IMS, Windows Registry, XML-based storage
Relational Databases (SQL)
These databases store data in tables made up of rows and columns. Each table has a defined structure (schema), and different tables can be linked using keys.
Key Features of Relational Database
- Strict table-based structure.
- Uses SQL to ask questions and update data.
- Supports ACID properties for reliable, consistent data.
- Usually scales by making the server stronger (vertical scaling).
Common Use of Relational Database
- Banks (transactions and balances).
- Online shopping (managing products and orders).
- CRM software (tracking customers).
- Hospitals (storing patient records).
[!Example] MySQL, PostgreSQL, Oracle, Microsoft SQL Server
Non-Relational Databases (NoSQL)
These are flexible databases that don’t use tables. They store data in formats like documents, key-value pairs, or graphs.
Key Features of non relational database
- Schema-free—you can store data in many formats.
- Good for big data and fast reads/writes.
- Scales easily by adding more machines (horizontal scaling).
- Doesn’t use SQL; each type has its own query method.
Common Uses of non relational database
- Social media (likes, comments, connections).
- IoT devices (sensors sending data constantly).
- Video/music platforms (personalized recommendations).
- Online games (player stats and live updates).
Types and Examples
- Key-Value Stores: Redis, DynamoDB (used for session data, caching)
- Document Databases: MongoDB, CouchDB (user profiles, CMS)
- Column-Family Stores: Cassandra, HBase (huge datasets, analytics)
- Graph Databases: Neo4j, Amazon Neptune (social networks, fraud detection)
Summary
Database Type | Structure | Best For | Examples |
---|---|---|---|
Hierarchical | Tree | File systems, org charts, legacy apps | IBM IMS, XML, Registry |
Relational (SQL) | Tables | Finance, ERP, healthcare, e-commerce | MySQL, Oracle, SQL Server |
Non-Relational (NoSQL) | Documents, graphs, key-values | Big data, social media, fast updates | MongoDB, Redis, Neo4j |
Advantages of Using a Database
Databases help efficiently store, manage, and retrieve data. Here are the key benefits:
- Organized & Efficient Storage – Data is structured, reducing redundancy and improving management.
- Fast & Accurate Data Retrieval – Optimized queries enable quick access to information.
- Data Integrity & Security – Enforces rules to maintain accuracy and restrict unauthorized access.
- Multi-User Access – Allows multiple users to work on data simultaneously.
- Backup & Recovery – Prevents data loss with automated backups.
- Better Decision-Making – Supports reporting and analytics for insights.
- Cost & Time Efficiency – Reduces manual work and improves operational efficiency.