Module 1 - DBMS Notes - Basic Concept
Module 1 - DBMS Notes - Basic Concept
Word 'Data' is originated from the word 'datum' that means 'single piece of information.' It is
plural of the word datum.
In computing, Data is information that can be translated into a form for efficient movement
and processing. Data is interchangeable.
To maintain large database, we need some operations that help in maintaining the data in the
database efficiently. Following operations performed on the database are:
1. Insertion: This operation is used to add a new record to the database. For Example: to
add a new number to the phone number directory.
2. Updation: This operation is used to update the existing data. For Example: Suppose
there is a change in the surname of a particular person, so you have to modify the
surname by replacing the surname number with a new surname.
3. Deletion: This operation is used to delete the existing data from the database. For
Example: suppose a person shifts from Ludhiana to Chandigarh then the information
about that person should be deleted from Ludhiana phone number directory.
4. Selection: This operation is used to retrieve the existing data. For Example: to view a
phone number directory of a particular person, we can search for his number from the
phone number directory.
5. Sorting: This operation is used to arrange the data in ascending or descending order.
For Example: in a phone number directory, the phone number should be arranged in
alphabetical order for fast retrieval.
Database
A database is an organized collection of data, so that it can be easily accessed and managed.
You can organize data into tables, rows, columns, and index it to make it easier to find
relevant information.
Database handlers create a database in such a way that only one set of software program
provides access of data to all the users.
The main purpose of the database is to operate a large amount of information by storing,
retrieving, and managing data.
There are many dynamic websites on the World Wide Web nowadays which are handled
through databases. For example, a model that checks the availability of rooms in a hotel. It is
an example of a dynamic website that uses a database.
There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix,
PostgreSQL, SQL Server, etc.
Database
A database is a group of interconnected data that is stored in a database server.
Purpose of Database:
There are various types of databases used for storing different varieties of data:
1) Centralized Database
It is the type of database that stores data at a centralized database system. It comforts the
users to access the stored data from different locations through several applications. These
applications contain the authentication process to let users access data securely. An example
of a Centralized database can be Central Library that carries a central database of each library
in a college/university.
All modern database management systems like SQL, MS SQL Server, IBM DB2, ORACLE,
My-SQL, and Microsoft Access are based on RDBMS.
A relational database is the most commonly used database. It contains several tables, and
each table has its primary key.
Due to a collection of an organized set of tables, data can be accessed easily in RDBMS.
Table/Relation
Everything in a relational database is stored in the form of relations. The RDBMS database
uses tables to store data. A table is a collection of related data entries and contains rows and
columns to store data. Each table represents some real-world objects such as person, place, or
event about which information is collected. The organized collection of data into a relational
table is known as the logical view of the database.
Properties of a Relation:
Row or record
A row of a table is also called a record or tuple. It contains the specific information of each
entry in the table. It is a horizontal entity in the table. For example, The above table contains
5 records.
Properties of a row:
Column/attribute
A column is a vertical entity in the table which contains all information associated with a
specific field in a table. For example, "name" is a column in the above table which contains
all information about a student's name.
Properties of an Attribute:
The smallest unit of data in the table is the individual data item. It is stored at the intersection
of tuples and attributes.
Degree:
The total number of attributes that comprise a relation is known as the degree of the table.
For example, the student table has 4 attributes, and its degree is 4.
Cardinality:
The total number of tuples at any one time in a relation is known as the table's cardinality.
The relation whose cardinality is 0 is called an empty table.
For example, the student table has 5 rows, and its cardinality is 5.
Domain:
The domain refers to the possible values each attribute can contain. It can be specified using
standard data types such as integers, floating numbers, etc. For example, An attribute entitled
Marital_Status may be limited to married or unmarried values.
NULL Values
The NULL value of the table specifies that the field has been left blank during record
creation. It is different from the value filled with zero or a field that contains space.
For example, If we say that the person's height is null, it means that such a person exists, he
must have height but we don't know what the height was at the time the data was collected.
So we mark it as null and we explain that we don't know what the actual value is,
Now shall be discussing the examples showing missing or unknown information and
inapplicable data.
In this section, we would read up on the dissimilarities between File system approach and
DBMS in detail. First of all we understand the basic of both the approach after that we will
understand the differences between them with the help of some examples.
Consider an example of a student's file system. The student file will contain information
regarding the student (i.e. roll no, student name, course etc.). Similarly, we have a subject file
that contains information about the subject and the result file which contains the information
regarding the result.
Some fields are duplicated in more than one file, which leads to data redundancy. So to
overcome this problem, we need to create a centralized system, i.e. DBMS approach.
DBMS:
In the above figure, duplication of data is reduced due to centralization of data. The fields
such as Room, Sub_Name, and Marks which were being repeated in the file system approach
are not repeated in this database approach due to centralization of data from different tables
by joining those using relationships when needed on the basis of the common fields.
Duplicity cannot be eliminated completely because we may need Redundancy in some cases
to access data quickly. So we control it but not eliminate it.
There are the following differences between DBMS and File systems:
Introduction of DBMS
DBMS (Database Management System) is a software system that manages, stores, and
retrieves data efficiently in a structured format.
1. Hardware
Physical devices like servers, disks, input-output devices (keyboard, monitor, printer).
Stores and processes data; interfaces between real-world inputs and digital systems.
Examples: Personal computer hard disk, RAM, network devices used for DBMS
operations.
2. Software
Actual DBMS software like MySQL, Oracle, PostgreSQL.
Includes the database engine, OS, network software, and application tools.
Translates database access languages into operations.
3. Data
Raw facts stored in structured or unstructured formats.
Operational Data: Actual user data (e.g., name, age).
Metadata: Data about data (e.g., storage time, size, data type).
Core reason DBMS exists—to manage and store data efficiently.
4. Procedures
Instructions and rules for using DBMS effectively.
Covers setup, login/logout, data validation, backup, access control, and report
generation.
Helps ensure consistent and secure use of the system.
5. Database Access Language
Used to interact with the database (create, read, update, delete data).
Examples: SQL, MyAccess, Oracle PL/SQL.
DDL (Data Definition Language) – CREATE, ALTER, DROP
DML (Data Manipulation Language) – INSERT, UPDATE, DELETE
6. People
Users interacting with DBMS at different levels:
Database Administrators (DBA) – Manage security, performance, user access.
Developers – Build applications using the database.
End Users – Use applications to access the database (e.g., students, employees).
Types of DBMS
There are several types of Database Management Systems (DBMS), each tailored to different
data structures, scalability requirements and application needs. The most common types are
as follows:
2. NoSQL DBMS
They are designed to handle large-scale data and provide high performance for scenarios
where relational models might be restrictive.
They store data in various non-relational formats, such as key-value pairs, documents, graphs
or columns.
These flexible data models enable rapid scaling and are well-suited for unstructured or semi-
structured data.
Examples: MongoDB, Cassandra, DynamoDB and Redis.
4. Hierarchical Database
Organizes data in a tree-like structure, where each record (node) has a single parent and have
multiple children.
This model is similar to a file system with folders and subfolders.
It is efficient for storing data with a clear hierarchy, such as organizational charts or file
directories.
Navigation is fast and predictable due to the fixed structure.
It lacks flexibility and difficult to restructure or handle complex many-to-many relationships.
Example: IBM Information Management System (IMS).
5. Network Database
It uses a graph-like model to allow more complex relationships between entities.
Unlike the hierarchical model, it permits each child to have multiple parents, enabling many-
to-many relationships.
Data is represented using records and sets, where sets define the relationships.
It is more flexible than the hierarchical model and better suited for applications with complex
data linkages.
Example: Integrated Data Store (IDS), TurboIMAGE.
6. Cloud-Based Database
They are hosted on cloud computing platforms like AWS, Azure or Google Cloud.
They offer on-demand scalability, high availability, automatic backups and remote
accessibility.
These databases can be relational (SQL) or non-relational (NoSQL) and are maintained by
cloud service providers, reducing administrative overhead.
They support modern application requirements, including distributed access and real-time
analytics.
Example: Amazon RDS (for SQL), MongoDB Atlas (for NoSQL), Google BigQuery.
Database Languages
Database languages are specialized sets of commands and instructions used to define,
manipulate and control data within a database. Each language type plays a distinct role in
database management, ensuring efficient storage, retrieval and security of data. The primary
database languages include:
CREATE: to create a database and its objects like (table, index, views, store
procedure, function and triggers)
ALTER: alters the structure of the existing database
DROP: delete objects from the database
TRUNCATE: remove all records from a table, including all spaces allocated for the
records are removed
COMMENT: add comments to the data dictionary
RENAME: rename an object
DCL commands manage access permissions, ensuring data security by controlling who can
perform certain actions on the database.
TCL commands oversee transactional data to maintain consistency, reliability and atomicity.
DQL is a subset of SQL used to retrieve data from a database without modifying it. Its main
command is SELECT, which allows users to fetch specific information based on their
requirements.
Applications of DBMS
DBMS Architecture
There are several types of DBMS Architecture that we use according to the usage
requirements.
1-Tier Architecture
2-Tier Architecture
3-Tier Architecture
1-Tier Architecture
In 1-Tier Architecture, the user works directly with the database on the same system. This
means the client, server and database are all in one application. The user can open the
application, interact with the data and perform tasks without needing a separate server or
network connection.
A common example is Microsoft Excel. Everything from the user interface to the
logic and data storage happens on the same device. The user enters data, performs
calculations and saves files directly on their computer.
This setup is simple and easy to use, making it ideal for personal or standalone
applications. It does not require a network or complex setup, which is why it's often
used in small-scale or individual use cases.
This architecture is simple and works well for personal, standalone applications where
no external server or network connection is needed.
1. Simple Architecture: 1-Tier Architecture is the most simple architecture to set up, as
only a single machine is required to maintain it.
2. Cost-Effective: No additional hardware is required for implementing 1-Tier
Architecture, which makes it cost-effective.
3. Easy to Implement: 1-Tier Architecture can be easily deployed and hence it is
mostly used in small projects.
1. Limited to Single User: Only one person can use the application at a time. It’s not
designed for multiple users or teamwork.
2. Poor Security: Since everything is on the same machine, if someone gets access to
the system, they can access both the data and the application easily.
3. No Centralized Control: Data is stored locally, so there's no central database. This
makes it hard to manage or back up data across multiple devices.
4. Hard to Share Data: Sharing data between users is difficult because everything is
stored on one computer.
2-Tier Architecture
The 2-tier architecture is similar to a basic client-server model. The application at the client
end directly communicates with the database on the server side. APIs like ODBC and JDBC
are used for this interaction. The server side is responsible for providing query processing and
transaction management functionalities.
On the client side, the user interfaces and application programs are run. The application on
the client side establishes a connection with the server side to communicate with the DBMS.
For
Client Layer (Tier 1): This is the user interface that library staff or users interact with. For
example they might use a desktop application to search for books, issue them, or check due
dates.
Database Layer (Tier 2): The database server stores all the library records such as book
details, user information and transaction logs.
The client layer sends a request (like searching for a book) to the database layer which
processes it and sends back the result. This separation allows the client to focus on the user
interface, while the server handles data storage and retrieval.
3-Tier Architecture
In 3-Tier Architecture, there is another layer between the client and the server. The client
does not directly communicate with the server. Instead, it interacts with an application server
which further communicates with the database system and then the query processing and
transaction management takes place. This intermediate layer acts as a medium for the
exchange of partially processed data between the server and the client. This type of
architecture is used in the case of large web applications.
User: You visit an online store, search for a product and add it to your cart.
Processing: The system checks if the product is in stock, calculates the total price and
applies any discounts.
Database: The product details, your cart and order history are stored in the database
for future reference.
History of Database
A database is an organized collection of data that allows easy access, management, and
updating. The concept of databases evolved as the need to store and process large amounts of
data increased.
Problems:
Data inconsistency
No data security
Advantages:
Simple structure
Fast data access
Disadvantages:
Inflexible
Complex relationships not supported
Advantages:
Disadvantages:
Example: IDMS
Advantages:
Easy to understand
Reduces redundancy
Advantages:
Supports real-world objects
Example: ObjectDB
Advantages:
High availability
Better performance
Fault tolerance
Types:
Key-Value
Document
Column-Based
Graph
Advantages:
Scalable
Cost-effective
High availability
Data independence refers to the ability to change the schema (structure) at one level without
affecting the schema at higher or lower levels in the DBMS architecture. It ensures that
changes in the data storage and structure do not impact the overall functioning or application
programs using the database.
Reduces Maintenance: Developers don't need to update applications every time the
database structure changes.
Increases Flexibility: The database can be reorganized or optimized internally
without affecting user queries.
Supports Long-Term Growth: As business needs evolve, the database can be updated
without breaking existing systems.
Physical Data Independence: Change in the internal level without affecting the
logical level.
Logical Data Independence: Change in the logical level without affecting the view
level.
Ability to change the logical structure (tables, columns, relationships) without affecting
external views or application programs. Purpose of this to allow the database structure to
evolve without impacting user access or requiring changes in application code.
Why it matters:
Remove a column
Split a table
Merge tables
Example
Original table:
Modified table:
Physical data independence can be defined as the capacity to change the internal
schema without having to change the conceptual schema.
If we do any changes in the storage size of the database system server, then the
Conceptual structure of the database will not be affected.
Physical data independence is used to separate conceptual levels from the internal
levels.
Physical data independence occurs at the logical interface level.
For example:
A new index is added to a table to improve the performance.
Existing index is dropped when it is no longer needed.
File System
The file system is basically a way of arranging the files in a storage medium like a hard disk.
The file system organizes the files and helps in the retrieval of files when they are required.
File systems consist of different files which are grouped into directories. The directories
further contain other folders and files. The file system performs basic operations like
management, file naming, giving access rules, etc.
A File System is a traditional way of storing data where information is saved in separate files
on a storage device (hard disk, USB, etc.).
Each application manages its own files, formats, and access methods.
Example
Student data stored in [Link]
Marks stored in [Link]
Attendance stored in [Link]
Each file is independent.
Characteristics of File System
Data is stored in flat files (text/binary)
Programs control how data is stored and accessed
No centralized control
Limited security and sharing
A Database System stores data in a structured and centralized manner using a DBMS
(Database Management System) such as MySQL, Oracle, SQL Server, etc.
The DBMS handles:
Data storage
Data retrieval
Security
Consistency
Backup & recovery
Example
A Student database with tables:
Student
Marks
Attendance
Advantages
Easy to understand
Good for database planning
Hides technical details
Disadvantages
Cannot be implemented directly
No storage details
Example:
StudentID Name Age
101 Rahul 20
Advantages
Simple and flexible
Data integrity using constraints
Most widely used (MySQL, Oracle, SQL Server)
Disadvantages
Complex queries for large databases
Performance issues with many joins
Example:
markdown
Copy code
Company
└── Department
└── Employee
Advantages
Fast access
Simple structure
Disadvantages
No many-to-many relationships
Difficult to modify
Data Models
A Data Model in Database Management System (DBMS) is the concept of tools that are
developed to summarize the description of the database. Data Models provide us with a
transparent picture of data which helps us in creating an actual database. It shows us from the
design of the data to its proper implementation of data.
Types of Relational Models
1. Conceptual Data Model
2. Representational Data Model
3. Physical Data Model
Components of ER Model:
Entity: An entity is referred to as a real-world object. It can be a name, place, object, class,
etc. These are represented by a rectangle in an ER Diagram.
Attributes: An attribute can be defined as the description of the entity. These are represented
by Ellipse in an ER Diagram. It can be Age, Roll Number, or Marks for a Student.
Relationship: Relationships are used to define relations among different entities. Diamonds
and Rhombus are used to show Relationships.
2. Network Model
The Network Model was formalized by the Database Task group in the 1960s. This model is
the generalization of the hierarchical model. This model can consist of multiple parent
segments and these segments are grouped as levels but there exists a logical association
between the segments belonging to any level. Mostly, there exists a many-to-many logical
association between any of the two segments.
Schema
A schema in DBMS refers to the overall design or blueprint of a database. It describes how
the data will be organized, how the relationships between different entities will be maintained
and how constraints will be applied. Schemas are important to defining the structure of the
database and once defined, they remain relatively stable over time.
Key Characteristics
Acts as a framework for data storage and manipulation.
Defined during the database design phase.
Changes to the schema are rare and require careful planning.
Types of Schema:
1. Logical Schema: Describes the logical structure, such as tables, columns, data types
and relationships.
2. Physical Schema: Details how the data is stored physically on hardware (e.g., file
paths, indexing).
3. View Schema: Defines how data is presented to end-users, possibly as a subset or a
formatted view.
Example: Let's say a table teacher in our database named school, the teacher table requires
the name, dob and doj in their table so we design a structure as:
Teacher (
name VARCHAR,
dob DATE,
doj DATE)
Advantages of Schema
Data Consistency and Integrity: A well-defined schema enforces rules and constraints
(like data types, primary keys, foreign keys, unique constraints, etc.).
Structured Organization of Data: Schema provides a systematic and logical structure to
store data.
Simplifies Data Access: By knowing the schema, users and developers can easily query
data using SQL, knowing exactly where and how data is stored.
Supports Data Security and Authorization: Schema-level definitions can help in
applying access controls and roles, allowing only authorized users to view or manipulate
certain parts of the data.
Facilitates Database Design and Documentation: The schema serves as documentation
for the database, making it easier to understand its structure and relationships.
Enables Logical and Physical Data Independence: Through logical and physical
schema separation, changes in storage details (physical schema) do not affect how users
interact with data (logical schema).
Disadvantages of Schema
Rigidity and Inflexibility: Once a schema is defined and implemented, modifying it can
be challenging, especially in production environments.
High Complexity in Large Systems: For complex systems with hundreds of tables and
relationships, schema design becomes very complex and time-consuming.
Requires Skilled Designers: Designing an optimal schema is not trivial. It demands deep
knowledge of data modelling, normalization and performance tuning.
Limited Adaptability to Changing Requirements: If business requirements evolve
(e.g., new data fields or relationships), adapting the schema might require schema
migration scripts, application code changes and extensive testing, making it less agile.
Overhead in Schema Maintenance: As the database grows and evolves, maintaining the
schema can be overhead-heavy, especially when dealing with distributed systems, version
control of schema files and synchronization across environments (development, staging,
production).
Dependency on Schema Knowledge: Application developers and users must be aware
of the schema structure to work effectively with the data.
Instance
An instance of DBMS refers to real data present in a database at some particular point in
time. It refers to the content in the database in as much as it refers to the structure defined
under a particular schema at a given point.
Key Characteristics
Advantages of Instance
Real-Time Representation of Data: An instance reflects the current state of the database
at a specific point in time.
Flexibility in Data Handling: While schemas are rigid and rarely change, instances are
highly dynamic.
Supports Day-to-Day Operations: Since instances store actual data, they are essential
for performing CRUD operations (Create, Read, Update, Delete) that are part of daily
business processes.
Basis for Decision-Making: Instances provide the live data required for data analytics,
forecasting, dashboards and reporting tools.
Multiple Instances Over Time Enable History Tracking: Though each instance is a
snapshot in time, by capturing them periodically (e.g., through backups or logs), one can
recreate historical data trends.
Disadvantages of Instance