Introduction to Databases and Database Systems
From the Data Base Systems curriculum
Introduction to Databases and Database Systems
TL;DR
Databases are organized collections of information, and database systems are the tools that let you create, manage, and use them efficiently. They solve problems like disorganized data, slow access, and data inconsistencies that come from storing information in simple files. Understanding them helps you build robust applications that rely on structured data.
1. The Mental Model
Think of a database like a super-organized digital filing cabinet for information. A database system is the smart assistant that knows exactly where everything is, can quickly fetch what you ask for, and keeps all the files tidy and safe.
2. The Core Material
You interact with databases all the time, even if you don't realize it—every time you log into a website, check your bank balance, or scroll through social media. At its heart, a database is a structured collection of data. This "structure" is key; it's not just a pile of random files.
A database system, often called a Database Management System (DBMS), is the software that allows you to interact with a database. It handles storing, retrieving, updating, and deleting data, ensuring everything stays consistent and secure.
Why Use a DBMS? (The Problems It Solves)

Photo by Ann H on Pexels
Before DBMSs, people stored data in separate files (like spreadsheets or text documents). This led to several headaches:
- Data Redundancy: The same information (e.g., a customer's address) might be stored in multiple files, leading to wasted space and potential for different versions of the truth.
- Data Inconsistency: If you update a customer's address in one file but forget to update it in another, your data becomes inconsistent. Which address is correct?
- Difficulty in Accessing Data: Finding specific information across many files can be slow and require writing custom code for every new query.
- Data Isolation: Data scattered in different files, in various formats, makes it hard to combine and analyze.
- Security Problems: Protecting sensitive data in individual files is tough; who has access to what?
- Integrity Problems: How do you enforce rules like "an order must always have a customer"? With files, it's manual and error-prone.
- Concurrency Issues: If multiple people try to update the same piece of data at the same time in separate files, what happens? Chaos.
A DBMS tackles these problems head-on:
graph TD
A["File-Based System Problems"] --> B["Data Redundancy"];
A --> C["Data Inconsistency"];
A --> D["Difficulty Accessing Data"];
A --> E["Data Isolation"];
A --> F["Security Concerns"];
A --> G["Integrity Issues"];
A --> H["Concurrency Challenges"];
B --> Z["DBMS Solution"];
C --> Z;
D --> Z;
E --> Z;
F --> Z;
G --> Z;
H --> Z;
Z["DBMS Solution"] --> I["Reduced Redundancy"];
Z --> J["Improved Data Consistency"];
Z --> K["Efficient Data Access"];
Z --> L["Data Integration"];
Z --> M["Enhanced Security"];
Z --> N["Data Integrity Enforcement"];
Z --> O["Concurrent Access Control"];
Key Components of a DBMS

Photo by Nic Wood on Pexels
While different DBMSs exist, they generally share core components:
- Data Definition Language (DDL): This is for defining the database structure (schema). Think of it as drawing the blueprints for your filing cabinet—deciding what types of drawers you'll have and what kind of information goes in each. You use DDL to create, alter, and drop tables.
- Data Manipulation Language (DML): This is for managing the actual data within that structure. It's like putting files into the cabinet, taking them out, updating them, or throwing them away. You use DML to insert, update, delete, and retrieve data.
- Query Processor: Takes your DML commands (like "find all customers in New York") and translates them into actions the database can perform. It figures out the most efficient way to get your data.
- Storage Manager: The component that actually interfaces with the file system, telling it where and how to store the data on disk. It handles reading and writing.
- Transaction Manager: Ensures that database operations are performed reliably, even if the system crashes. It makes sure that either all steps of a complex operation complete successfully, or none of them do.
- Concurrency Control Manager: Handles multiple users accessing the database simultaneously, preventing conflicts and maintaining data integrity.
- Backup and Recovery Subsystem: Creates copies of your data and restores the database to a consistent state after a failure.
Types of Databases

Photo by Jakub Zerdzicki on Pexels
You'll mostly encounter these:
- Relational Databases (SQL Databases): The most common type. Data is stored in tables (like spreadsheets) with rows and columns. They use SQL (Structured Query Language) for defining and manipulating data. Examples: MySQL, PostgreSQL, Oracle, SQL Server.
- NoSQL Databases (Non-Relational Databases): A newer category designed for specific use cases, often handling very large datasets or unstructured/semi-structured data more flexibly than relational databases. They don't use the traditional table structure and usually don't use SQL. Examples: MongoDB (document-based), Cassandra (column-family), Redis (key-value).
3. Worked Example
Let's say you're building a simple contact list for a small business.
Without a DBMS (using simple text files or spreadsheets):
You might have a file called customers.txt with names and phone numbers, and another file orders.txt with order details. If you wanted to see all orders placed by a specific customer, you'd have to manually link them by customer name or ID in your head or by writing complex code to read both files and match entries. If a customer changes their phone number, you'd have to find and update it in every file where it appears.
With a DBMS (Relational Database example):
You'd define two tables:
-
Customerstable:customer_id(unique number)first_namelast_namephone_numberemail
-
Orderstable:order_id(unique number)customer_id(links to the Customers table)order_datetotal_amount
Here's how you'd create these tables using DDL (SQL):
-- Create the Customers table
CREATE TABLE Customers (
customer_id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
phone_number VARCHAR(15),
email VARCHAR(100) UNIQUE
);
-- Create the Orders table, linking to Customers
CREATE TABLE Orders (
order_id INT PRIMARY KEY AUTO_INCREMENT,
customer_id INT NOT NULL,
order_date DATE NOT NULL,
total_amount DECIMAL(10, 2) NOT NULL,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
Then, to add some data (DML - INSERT):
INSERT INTO Customers (first_name, last_name, phone_number, email)
VALUES ('Alice', 'Smith', '555-1234', 'alice@example.com');
INSERT INTO Orders (customer_id, order_date, total_amount)
VALUES (1, '2023-10-26', 99.99);
To find all orders by Alice Smith (DML - SELECT):
SELECT
C.first_name,
C.last_name,
O.order_id,
O.order_date,
O.total_amount
FROM
Customers C
JOIN
Orders O ON C.customer_id = O.customer_id
WHERE
C.first_name = 'Alice' AND C.last_name = 'Smith';
This single SQL query efficiently retrieves related information from two tables, which would be much harder to do with separate files.
4. Key Takeaways
- A database is an organized collection of data, while a DBMS is the software that manages it.
- DBMSs solve critical problems like data redundancy, inconsistency, and security issues that arise from file-based data storage.
- You use DDL (Data Definition Language) to define the database structure and DML (Data Manipulation Language) to manage the actual data.
- Relational databases, which use SQL and store data in tables, are the most common type.
- NoSQL databases offer alternatives for specific data models and scalability needs, diverging from the traditional table structure.
- The DBMS handles complex tasks like concurrent access, transaction management, and efficient data retrieval behind the scenes.
Common Mistakes to Avoid:
- Thinking a spreadsheet is a database system; it's just a file-based tool for data storage.
- Ignoring the importance of a well-designed database schema (structure); it prevents many future problems.
- Trying to manage application data directly in files when a DBMS would be far more suitable.
- Confusing the database (the data itself) with the DBMS (the software that manages it).
5. Now Try It
Spend 15 minutes researching a popular Relational Database Management System (like MySQL or PostgreSQL) and a popular NoSQL database (like MongoDB or Redis). For each, jot down:
1. What it's generally used for.
2. One key advantage it offers.
3. One key difference in how it stores data compared to the other.
Success looks like you can clearly articulate the distinct purposes and fundamental differences between a relational and a non-relational database.
Frequently asked about Introduction to Databases and Database Systems
Get the full Data Base Systems curriculum
Clone the complete plan to your dashboard for unlimited AI-generated notes, practice quizzes, and a personalised revision schedule.
Create Free Account