Introduction to Database
A database is a structured collection of data that is stored
and accessed electronically. Databases are designed to
manage large bodies of information by providing efficient
retrieval, storage, and management of data. They are
crucial for various applications ranging from simple tasks
like storing contact details to complex operations like
managing enterprise-level data.
Purpose of a Database System
The primary purpose of a database system is to provide an
efficient, convenient, and reliable way to store, retrieve,
and manage data. Key objectives include:
- Data Organization: Structure data to reduce redundancy
and improve data integrity.
- Data Accessibility: Allow users to efficiently retrieve and
manipulate data.
- Data Security: Ensure that data is protected from
unauthorized access.
- Data Integrity: Maintain the accuracy and consistency of
data over its entire lifecycle.
- Data Management: Support the creation, manipulation,
and maintenance of data.
Characteristics of the Database Approach
1. Self-describing Nature: A database contains both data
and metadata (data about data), which describes the
database's structure.
2. Data Abstraction: Provides different levels of abstraction
to hide complexities from users.
3. Data Independence: Allows changes to data structures
without affecting applications.
4. Multi-user Support: Supports concurrent access by
multiple users, maintaining data consistency.
5. Controlled Redundancy: Minimizes data duplication and
inconsistencies.
6. Security and Authorization: Implements access control
to secure data.
Data Models
A data model defines how data is structured and
manipulated. Common data models include:
- Hierarchical Model: Organizes data in a tree-like structure
with parent-child relationships.
- Network Model: Represents data using graphs with
many-to-many relationships.
- Relational Model: Uses tables (relations) to represent
data and relationships between data.
- Object-oriented Model: Combines data with the methods
that operate on that data, supporting complex data types.
Database Management System (DBMS)
A DBMS is a software system that enables users to define,
create, maintain, and control access to the database. It
provides the following functionalities:
- Data Definition Language (DDL): Allows users to define
the database structure.
- Data Manipulation Language (DML): Provides operations
for retrieving and updating data.
- Query Language: Allows users to query the database,
such as SQL (Structured Query Language).
- Transaction Management: Ensures that database
transactions are processed reliably.
- Concurrency Control: Manages simultaneous data access
to prevent conflicts.
Database System Architecture
Database systems typically follow a layered architecture:
- Internal Level: The physical storage of data, focusing on
performance and efficiency.
- Conceptual Level: Provides a community user view, hiding
storage details.
- External Level: Represents various user views, focusing on
the specific user interface.
Three-Schema Architecture
The three-schema architecture is a framework for
understanding and describing the structure of database
systems. It consists of:
1. Internal Schema: Describes the physical storage structure
of the database.
2. Conceptual Schema: Represents the logical structure of
the entire database.
3. External Schema: Defines how individual users view data.
This architecture aims to provide data abstraction and
independence.
Components of DBMS
The DBMS consists of several components, including:
- Database Engine: Core service for accessing and
processing data.
- Database Schema: Structure that defines the organization
of data.
- Query Processor: Interprets and executes database
queries.
- Transaction Manager: Ensures transactions are processed
reliably and maintain database integrity.
- Storage Manager: Handles data storage and retrieval.
Data Independence
Data independence is the capacity to change the schema at
one level of a database system without changing the
schema at the next higher level. It has two types:
- Logical Data Independence: Ability to change the
conceptual schema without affecting external schemas.
- Physical Data Independence: Ability to change the internal
schema without affecting the conceptual schema.
File System Approach vs. Database System Approach
File System Approach:
- Data Redundancy and Inconsistency: Files often contain
duplicated data, leading to inconsistencies.
- Data Isolation: Data is scattered in various files, making it
difficult to retrieve.
- Lack of Atomicity: Operations are not atomic, risking data
corruption during failures.
- Concurrent Access Issues: Difficulty in handling
concurrent data access.
Database System Approach:
- Reduced Data Redundancy: Centralized control minimizes
data duplication.
- Improved Data Integrity: Constraints and rules ensure
data accuracy.
- Efficient Data Retrieval: Advanced query languages allow
efficient data access.
- Concurrency Control: Manages concurrent access,
maintaining data consistency.
Summary
Databases and DBMSs play a crucial role in modern
applications by efficiently managing and organizing data.
They provide a structured approach to handle large
volumes of data while ensuring data integrity, security, and
consistency. The transition from file systems to database
systems marks a significant improvement in data handling
capabilities, making them indispensable for businesses and
organizations.