Module 1
Module 1
Basics
Explain the advantages of the DBMS approach.
Explain the characteristics of the database approach.
What is a data model? Explain the concept of data independence.
With a neat labeled diagram explain three schema architecture.
Explain a simplified database environment with a suitable diagram.
Explain the various types of attributes that occur in E-R diagram model with an example.
Explain the types of entity type with example.
What is weak entity type? Explain the role of partial key in weak entity type.
Explain the following with an example for each:
a) Many-to-One relationship
b) One-to-Many relationship
Explain relationship types and relationship set with examples for N:1 and M:N relationships.
Bring out the difference between the following with example:
Explain the types of DBMS interfaces.
Explain the various types of End Users.
ER Diagrams
Basics
A database is a collection of related data with implicit meaning.
1. Defining a Database
Allows the specification of data types, structures, and constraints for the data to
be stored in the database.
2. Constructing
Module 1 1
The process of storing the data on a storage medium that is controlled by the
DBMS.
3. Manipulating
4. Sharing
Entity
Attributes
Example: For the entity "Student," attributes could include "Student ID," "Name,"
"Date of Birth," and "Address."
Entity Set
A collection of similar types of entities. All entities in an entity set have the same
attributes.
Example: All students in a university database form the entity set "Students."
Relationship Set
Module 1 2
The Database Management System (DBMS) approach offers several advantages over
traditional file processing systems. Here are some key advantages highlighted in the provided
PDF file:
1. Controlling Redundancy:
In traditional file processing systems, each user group maintains its own files,
leading to redundant storage of data.
DBMS provides mechanisms to control access to the database, ensuring that only
authorized users can view or modify data.
DBMS offers persistent storage for program objects and data structures, allowing
applications to store and retrieve data efficiently without worrying about data loss.
DBMS offers a variety of user interfaces tailored to different user needs, including
query languages, programming interfaces, forms, command codes, and graphical
user interfaces (GUIs).
A DBMS can handle various types of complex relationships among data entities,
making it easier to retrieve and update related data efficiently.
Module 1 3
This helps maintain data quality and consistency within the database.
DBMS includes facilities for backup and recovery, ensuring data durability in case
of hardware or software failures.
The system can restore the database to a consistent state after a failure, minimizing
data loss and downtime.
The database approach offers several additional benefits, including the potential for
enforcing standards, reduced application development time, flexibility in adapting to
changing requirements, availability of up-to-date information, and economies of
scale.
Contains both data and a complete definition of the database structure and
constraints.
Metadata stored in the system catalog includes information such as file structure,
data types, storage formats, and constraints.
The DBMS software must work equally with different database applications.
In traditional file processing, the structure of the files is embedded in the application
programs.
Any changes in file may require to change all programs that access the file.
Separates the data structure from the access programs, unlike traditional file
processing systems.
Module 1 4
Stores data structure independently in the DBMS catalog, providing program-data
independence.
Eg: suppose we want to add date of birth to the student database we can easily add to
the metadata that will be reflected in the database.
A view may be a subset of database or it may contain virtual data that is derived
from the database files but is not explicitly stored.
Allows different users to see the data in different ways based on their requirements.
Enables users to define and access customized views without affecting the
underlying data storage.
Ensures data consistency and integrity during concurrent access through locking and
transaction management.
Enables multiple users to work with the database simultaneously while maintaining
data integrity.
Allows for changes to the database structure without affecting stored data or existing
application programs.
Ensures that changes made by one user are immediately visible to all other users.
Economies of Scale:
Module 1 5
Allows for the consolidation of data and applications, reducing redundancy and
promoting efficiency.
These characteristics collectively highlight the advantages of the database approach in terms
of data management, flexibility, efficiency, and scalability, making it a preferred choice for
modern information systems.
It provides a systematic way to organize and represent data, facilitating efficient storage,
retrieval, and manipulation within a database system.
Data models are essential for defining how data is connected, how it can be categorized,
and the rules governing these relationships.
1. Entities: Objects or concepts that can have data stored about them.
Provide concepts that are close to the way many users perceive data (Also called
entity-based or object-based data models)
Module 1 6
Describes how data is stored in the database, including tables, columns, and indexes.
Physical data models describe how data is stored as files in the computer.
Access path is a search structure that makes the search for particular database
records efficient, such as indexing or hashing
For example, adding a new attribute to a table does not necessitate changes to
external applications that access the data.
Enables changes to the internal schema without affecting the conceptual or external
schemas.
For instance, reorganizing files or optimizing storage structures can be done without
altering the logical structure or affecting external applications.
Scalability: Allows database systems to grow and improve without major overhauls.
Example
Logical Data Independence:
Module 1 7
Existing applications not using Email remain unaffected.
The database administrator changes the indexing method for the Students table to
improve performance.
The conceptual schema and application programs accessing the data remain unchanged.
By adhering to data independence principles, DBMS ensures robust, adaptable, and efficient
data management, enhancing overall system functionality and user experience.
Module 1 8
With a neat labeled diagram explain three schema architecture.
The Three-Schema Architecture, also known as the ANSI/SPARC architecture, provides
a conceptual framework for understanding the structure and organization of a database
system.
The external schema represents the user views or external perspectives of the database.
Each external schema describes the part of the database that a specific user group is
interested in.
External schemas hide the details of the entire database, showing only the relevant
portions to each user group.
Users interact with the database through their respective external schemas.
The conceptual schema represents the overall logical structure of the entire database.
It describes the database for the entire community of users, providing a global view of
the data.
The conceptual schema hides the physical storage details and focuses on defining
entities, relationships, constraints, and operations.
The internal schema describes the physical storage structure of the database.
It includes details such as storage formats, access paths, indexing methods, and physical
storage allocation.
The internal schema is concerned with how data is stored on the storage devices.
It interacts directly with the physical data model and manages the actual storage and
retrieval of data.
Module 1 9
In this architecture:
The internal schema defines the physical storage details of the database.
This architecture helps in achieving data independence, supporting multiple views of the data,
and maintaining a clear separation between different levels of abstraction in a database
system.
2. Database System: The overall system that manages the storage, retrieval, and
manipulation of data. It includes the database management system (DBMS) and the
stored database.
Module 1 10
4. DBMS Software: The software responsible for managing the database system, including
handling queries, enforcing data integrity, and ensuring security.
6. Software to Access Stored Data: Tools and interfaces that allow users to access and
interact with the data stored in the database.
8. Stored Database: The actual data stored in the database system, including tables,
records, and relationships between data entities.
Module 1 11
Users/Programmers interact with the database system by submitting queries and running
applications.
The DBMS software processes queries and manages the stored database.
Application programs and software tools access the stored data within the database.
The stored database definition (meta-data) provides information about the database
structure.
The stored database contains the actual data stored within the system.
This diagram illustrates the basic components of a simplified database environment and the
flow of interactions between users, programs, the DBMS, and the stored database.
Explain the various types of attributes that occur in E-R diagram model
with an example.
In an Entity-Relationship (E-R) diagram model, various types of attributes can be represented
to describe entities and their properties. Here are the different types of attributes that occur in
an E-R diagram model along with examples:
1. Simple Attributes:
Definition: Simple attributes are indivisible and cannot be further decomposed into
smaller parts.
2. Composite Attributes:
3. Single-Valued Attributes:
Definition: Single-valued attributes have a single value for each entity instance.
Module 1 12
Example: The attribute "Age" in an employee entity is a single-valued attribute.
Each employee has only one age value associated with them.
4. Multi-Valued Attributes:
Definition: Multi-valued attributes can have multiple values for each entity instance.
5. Stored Attributes:
Definition: Stored attributes are directly stored in the database and are part of the
physical schema.
6. Derived Attributes:
Definition: Derived attributes are not stored in the database but can be derived from
other attributes.
Example: The attribute "Age" in the employee entity can be a derived attribute
calculated from the employee's birth date. It is not stored explicitly but can be
calculated when needed.
7. Key Attributes:
Definition: Key attributes uniquely identify each entity instance within an entity set.
These various types of attributes play a crucial role in defining the structure and
characteristics of entities in an E-R diagram model, providing a comprehensive representation
of the data within a database system.
Module 1 13
What is weak entity type? Explain the role of partial key in weak entity
type.
A weak entity type is an entity type that does not have a primary key attribute of its own and
depends on the existence of another entity (known as the owner entity) for its identification.
Weak entity types are identified by their relationship with the owner entity and a partial key
attribute.
Role of Partial Key in Weak Entity Type:
1. Identification:
The partial key in a weak entity type is a set of attributes that, in combination with
the owner entity, uniquely identifies each weak entity.
It helps in distinguishing one weak entity from another weak entity related to the
same owner entity.
2. Dependency:
A weak entity type has a total participation constraint with respect to its identifying
relationship, meaning that it cannot exist without being related to an owner entity.
The partial key ensures that each weak entity is uniquely identified within the
context of its relationship with the owner entity.
3. Example:
The attributes of the "Dependent" entity type may include Name, BirthDate, Sex,
and Relationship to the employee.
The partial key in this scenario could be the "Name" attribute of the dependent, as it
uniquely identifies a dependent within the scope of a specific employee.
The combination of the owner entity (Employee) and the partial key (Name)
uniquely identifies each dependent entity.
In summary, the partial key in a weak entity type plays a crucial role in uniquely identifying
weak entities in relation to their owner entity. It ensures that each weak entity is
distinguishable and dependent on the existence of the owner entity for its identification within
the database schema.
Module 1 14
Explain the following with an example for each:
a) Many-to-One relationship
b) One-to-Many relationship
a) Many-to-One Relationship:
Diagram:
+-----------+ +-----------+
| Student | | Department|
+-----------+ +-----------+
| StudentID | | DeptID |
| Name | | Name |
| GPA | | Location |
| DeptID | +-----------+
+-----------+
b) One-to-Many Relationship:
Diagram:
+-----------+ +-----------+
| Manager | | Employee |
+-----------+ +-----------+
| ManagerID | | EmployeeID|
| Name | | Name |
| Department| | Salary |
Module 1 15
+-----------+ | ManagerID |
+-----------+
In both relationships, the diagrams illustrate the connectivity between entities. The many-to-
one relationship shows that multiple instances of one entity type are linked to a single
instance of another entity type, while the one-to-many relationship indicates that a single
instance of one entity type is associated with multiple instances of another entity type.
Module 1 16
Explain relationship types and relationship set with examples for N:1
and M:N relationships.
Relationship Types and Relationship Set:
Definition: In an N:1 relationship, multiple instances of one entity type are associated
with a single instance of another entity type.
Diagram:
+-----------+ +-----------+
| Department| | Employee |
+-----------+ +-----------+
| DeptID | | EmpID |
| Name | | Name |
| Location | | Salary |
+-----------+ | DeptID |
+-----------+
Relationship Set: Each department can have multiple employees working in it, creating
a one-to-many relationship between Department and Employee entities.
Definition: In an M:N relationship, multiple instances of one entity type are associated
with multiple instances of another entity type.
Module 1 17
Example: Consider a "Student" entity and a "Course" entity in a university database.
Each student can enroll in multiple courses, and each course can have multiple students
enrolled.
Diagram:
+-----------+ +-----------+
| Student | | Course |
+-----------+ +-----------+
| StudentID | | CourseID |
| Name | | Title |
| GPA | | Credits |
+-----------+ +-----------+
Relationship Set: Students can enroll in multiple courses, and courses can have multiple
students enrolled, representing a many-to-many relationship between Student and Course
entities.
In both examples, the relationship types and sets demonstrate how entities are connected in
the database schema, highlighting the associations between different entity types in N:1 and
M:N relationships.
Composite Attributes: Composite attributes can be divided into smaller subparts, each
representing more basic attributes with independent meanings. For example, an
"Address" attribute can be decomposed into "Street Address," "City," "State," and "Zip
Code" attributes.
Simple (Atomic) Attributes: Simple attributes are indivisible and do not have internal
components. They represent basic, single data elements. For instance, attributes like
"Name," "Age," or "ID" are considered simple attributes.
Single-Valued Attributes: Single-valued attributes have only one value for a particular
entity. For example, the attribute "Age" for a person entity would have a single value
representing the person's age.
Module 1 18
Multivalued Attributes: Multivalued attributes can have a set of values for the same
entity. For instance, a "Colors" attribute for a car entity can have multiple values if the
car has multiple colors, such as a two-tone car having two color values.
Stored Attributes: Stored attributes are directly stored within the database and are not
calculated or derived from other attributes. For example, attributes like "Name" or
"Salary" are typically stored attributes.
Derived Attributes: Derived attributes are calculated or derived from other attributes in
the database. For instance, the "Age" attribute of a person can be derived from the
person's "Birth Date" and the current date. The "Age" attribute is not stored explicitly but
calculated when needed.
In summary, composite attributes are made up of subparts, while simple attributes are
indivisible. Single-valued attributes have one value per entity, while multivalued attributes
can have multiple values. Stored attributes are directly stored in the database, while derived
attributes are calculated based on other attribute values.
Module 1 19
3. User-Friendly DBMS Interfaces
Menu-Based Interfaces for Browsing:
Forms-Based Interfaces:
Display forms for users to input data or specify queries. Ideal for users unfamiliar
with query languages.
Combination Interfaces:
Incorporate multiple elements like menus and forms, commonly used in web
database interfaces.
Allows users to interact with the DBMS through voice commands and responses.
Users access the database through a web browser, often combining menu, form,
and graphical elements.
Parametric Interfaces:
Designed for users with repetitive tasks (e.g., bank tellers), providing predefined
operations to minimize keystrokes.
Privileged commands for DBAs to manage user accounts, set system parameters,
grant authorizations, and modify schemas.
Module 1 20
Explain the various types of End Users.
1. Naive or Parametric End Users:
Job function involves querying and updating the database using standard queries and
updates known as canned transactions.
Examples include bank tellers who check account balances and post transactions.
3. Stand-Alone Users:
Examples include individuals using tax packages for personal financial data storage.
Each type of end user interacts with the database system differently based on their roles,
expertise, and requirements, highlighting the diverse user base in database management.
ER Diagrams
Module 1 21
Car insurance
Module 1 22
Module 1 23