KEMBAR78
Unit 1 Dbms | PDF | Databases | Inheritance (Object Oriented Programming)
0% found this document useful (0 votes)
5 views33 pages

Unit 1 Dbms

The document provides an overview of database systems, defining key concepts such as databases, data, records, and the advantages of using a Database Management System (DBMS) over traditional file systems. It discusses various data models, including relational, entity-relationship, and object-based models, as well as the three-tier architecture of databases. Additionally, it outlines the roles of different database users, including Database Administrators and application programmers.

Uploaded by

Mahaboob Saniya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views33 pages

Unit 1 Dbms

The document provides an overview of database systems, defining key concepts such as databases, data, records, and the advantages of using a Database Management System (DBMS) over traditional file systems. It discusses various data models, including relational, entity-relationship, and object-based models, as well as the three-tier architecture of databases. Additionally, it outlines the roles of different database users, including Database Administrators and application programmers.

Uploaded by

Mahaboob Saniya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

UNIT – I

Database System

Database: A database is a collection of related data which represents some aspect of


the real world. A database system is designed to be built and populated with data for a
certain task.

Or

It is a collection of interrelated data.


These can be stored in the form of tables.
A database can be of any size and varying complexity.
A database may be generated and manipulated manually or it may be computerized.
Example: Customer database consists the fields as cname, cno, and ccity

Cname Cno Ccity

Let us see a simple example of a university database. This database is maintaining


information concerning students, courses, and grades in a university environment. The
database is organized as five files:

The STUDENT file stores data of each student


The COURSE file stores contain data on each course.
The SECTION stores the information about sections in a particular
course. The GRADE file stores the grades which students receive in
the various sections The TUTOR file contains information about
each professor.

Data: Facts, figures, statistics etc. having no particular meaning (e.g. 1, ABC, 19 etc).
Record: Collection of related data items, e.g. in the above example the three data
items had no meaning. But if we organize them in the following way, then they
collectively represent meaningful information.
Roll Name Age

1 ABC 19

Table or Relation: Collection of related records.

Roll Name Age


1 ABC 19

2 DEF 22

3 XYZ 28

The columns of this relation are called Fields, Attributes or Domains. The rows are
called Tuples or Records.

Database System: It is computerized system, whose overall purpose is to maintain the


information and to make that the information is available on demand.
Advantages:
1. Redundancy can be reduced.
2. Inconsistency can be avoided.
3. Data can be shared.
4. Standards can be enforced.
5. Security restrictions can be applied.
6. Integrity can be maintained.
7. Data gathering can be possible. 8. Requirements can be balanced.

Topic:Characteristics (Database Vs File


System),
a)File System(disadvantages)(drawbacks of file system)
Data Redundancy
Redundancy means having multiple copies of the same data. In computer
file-based processing system, each application program has its own data files. The
same data may be duplicated in more than one file. The duplication of data may
create many problems such as:
1. To update a specific data/record, the same data must be updated in all
files, otherwise different file may have different information about a
specific item.
2. A valuable storage space is wasted.
• Data Inconsistency

Data inconsistency mean that different files may contain different information of
a particular object or person. Actually redundancy leads to inconsistency.When the
same data is stored in multiple locations, the inconsistency may occur.
• Data Isolation

In computer file-based system, data is isolated in separate files. It is difficult to


update and to access particular information from data files.

• Data Atomicity
Data atomicity means data or record is either entered as a whole or it
is not entered at all.
• Data Dependence

In computer file-based processing systems, the data stored in file depends


upon the application program through which the file was created. It means that
the structure of data files is coupled with application program.

• Data Sharing

In computer file-based processing systems, each application program uses its


own private data files. The computer file-based processing systems do not provide the
facility to share data of a data file among multiple users on the network.
• Data Security

The computer file-based processing system do not provide the proper security
system against illegal access of data. Anyone can easily change or delete valuable data
stored in the data file. It is the most complicated problem of file-processing system.
• Incompatible File Format

In computer file-based processing systems, the structure of data file is coupled


with the application program and the structure of data file is dependent on the
programming languages in which the application program was developed.
b)Database Management System (DBMS)(advantages)
1.Reduction in data Redundancy: Data redundancy refers to the duplication of data
(i.e storing same data multiple times). In a database system, by having a
centralized database and centralized control of data the unnecessary duplication of
data is avoided. It also eliminates the extra time for processing the large volume of
data. It results in saving the storage space.
2. Data Consistency: DBMS allows defining constraints and rules to ensure that data is
consistent and accurate. DBMS ensures data consistency by enforcing data validation
rules and constraints. This ensures that data is accurate and consistent across different
applications and users.

3.Data Access and Availability: DBMS provides efficient data access and retrieval
mechanisms that enable quick and easy data access. It allows multiple users to access the
data simultaneously, ensuring data availability.

4.Data Integrity : Integrity means that the data in the database is accurate. Centralized
control of the data helps in permitting the administrator to define integrity constraints to
the data in the database. For example: in customer database we can can enforce an
integrity that it must accept the customer only from Noida and Meerut city.
5.Security : The DBA can define authorization checks to be carried out whenever access
to sensitive data is attempted.To prevent illegal access, alteration, or theft, database
management systems (DBMS) include a number of security features, including
encryption, authentication, and authorization. Sensitive data is safeguarded against both
internal and external attacks thanks to this.

6.Improved Data Backup and Recovery: DBMS provides backup and recovery
mechanisms that ensure data is not lost in case of a system failure. It allows restoring data
to a specific point in time, ensuring data consistency. Database management systems
(DBMS) offer backup and recovery features that let businesses swiftly and effectively
restore lost or damaged data. This guarantees business continuity and lowers the chance
of data loss.

7.Data independence: By separating the logical and physical views of data, database
management systems (DBMS) enable users to work with data without being aware of its
exact location or structure. This offers adaptability and lowers the possibility of data
damage as a result of modifications to the underlying hardware or software.

8.Concurrency and maintained Atomicity: That means, if some operation is performed on


one particular table of the database, then the change must be reflected for the entire
database. The DBMS allows concurrent access to multiple users by using the
synchronization technique

TOPIC:Database Management System & its


Applications
DEF:The software which is used to manage database is called Database Management System
(DBMS). For Example, MySQL, Oracle etc. are popular commercial DBMS used in different
applications.

The overall purpose of DBMS is to allow he users to define, store, retrieve and update the
information contained in the database on demand. I DBMS allows users the following tasks:

Data Definition: It helps in creation, modification and removal of definitions that define the
organization of data in database.
Data Updation: It helps in insertion, modification and deletion of the actual data in the database.

Data Retrieval: It helps in retrieval of data from the database which can be used by applications for
various purposes.

User Administration: It helps in registering and monitoring users, enforcing data security, monitoring
performance, maintaining data integrity, dealing with concurrency control and recovering
information corrupted by unexpected failure.
Database Applications:

Databases touch all aspects of our lives. Some of the major areas of application are as follows:

1. Banking

2. Airlines

3. Universities

4. Manufacturing and selling

5. Human resources

Enterprise Information

◦ Sales: For customer, product, and purchase information.

◦ Accounting: For payments, receipts, account balances, assets and other accounting information.

◦ Human resources: For information about employees, salaries, payroll taxes, and benefits, and for
generation of paychecks.

Manufacturing: For management of the supply chain and for tracking production of items in
factories, inventories of items inwarehouses and stores, and orders for items.

Online retailers: For sales data noted above plus online order tracking, generation of
recommendation lists, and maintenance of online product evaluations. ◦ Banking: For customer
information, accounts, loans, and banking transactions.

◦ Credit card transactions: For purchases on credit cards and generation of monthly statements.

◦ Finance: For storing information about holdings, sales, and purchases of financial instruments
such as stocks and bonds; also for storing real-time market data to enable online trading by
customers and automated trading by the firm.

◦ Universities: For student information, course registrations, and grades (in addition to standard
enterprise information such as human resources and accounting).
◦ Airlines: For reservations and schedule information. Airlines were among the first to
use databases in a geographically distributed manner.
◦ Telecommunication: For keeping records of calls made, generating monthly bills, maintaining
balances on prepaid calling cards, and storing information about the communication networks.

Topic:Advantages of DBMS:
1.Reduction in data Redundancy: Data redundancy refers to the duplication of data
(i.e storing same data multiple times). In a database system, by having a
centralized database and centralized control of data the unnecessary duplication of
data is avoided. It also eliminates the extra time for processing the large volume of
data. It results in saving the storage space.
2. Data Consistency: DBMS allows defining constraints and rules to ensure that data is
consistent and accurate. DBMS ensures data consistency by enforcing data validation
rules and constraints. This ensures that data is accurate and consistent across
different applications and users.

3.Data Access and Availability: DBMS provides efficient data access and retrieval
mechanisms that enable quick and easy data access. It allows multiple users to access
the data simultaneously, ensuring data availability.

4.Data Integrity : Integrity means that the data in the database is accurate.
Centralized control of the data helps in permitting the administrator to define integrity
constraints to the data in the database. For example: in customer database we can can
enforce an integrity that it must accept the customer only from Noida and Meerut city.

5.Security : The DBA can define authorization checks to be carried out whenever
access to sensitive data is attempted.To prevent illegal access, alteration, or theft,
database management systems (DBMS) include a number of security features,
including encryption, authentication, and authorization. Sensitive data is safeguarded
against both internal and external attacks thanks to this.

6.Improved Data Backup and Recovery: DBMS provides backup and recovery
mechanisms that ensure data is not lost in case of a system failure. It allows restoring
data to a specific point in time, ensuring data consistency. Database management
systems (DBMS) offer backup and recovery features that let businesses swiftly and
effectively restore lost or damaged data. This guarantees business continuity and
lowers the chance of data loss.

7.Data independence: By separating the logical and physical views of data, database
management systems (DBMS) enable users to work with data without being aware of
its exact location or structure. This offers adaptability and lowers the possibility of
data damage as a result of modifications to the underlying hardware or software.

8.Concurrency and maintained Atomicity: That means, if some operation is performed


on one particular table of the database, then the change must be reflected for the
entire database. The DBMS allows concurrent access to multiple users by using the
synchronization technique

TOPIC : Data Models


Data models define how the logical structure of a database is modeled.
DataModels are fundamental entities to introduce abstraction in a DBMS.
Data models define how data is connected to each other and how they are processed
and stored inside the system.
The data models can be classified into four different categories:

1. Relational Model. The relational model uses a collection of tables to represent


both data and the relationships among those data. Each table has multiple columns,
and each column has a unique name. Tables are also known as relations. The
relational model is an example of a record-based model.
EX:
2.Entity-Relationship Model. The entity-relationship (E-R) data model uses a
collection of basic objects, called entities, and relationships among these
objects.

​ Entities and their attributes.


​ Relationships among entities.
​ Entity Set - A set of the same type of entities is known as an entity set.
For example - Set of students studying in a college.
​ Attributes - Properties that define entities are called attributes. They
are represented by an ellipse shape.
​ Relationships - A relationship in DBMS is used to describe the
association between entities. They are represented as diamond or
rhombus shapes in the ER diagram.


3.Object-Based Data Model. Object-oriented programming (especially in Java,
C++, or C#) has become the dominant software-development methodology. This
led to the development of an object- oriented data model that can be seen as
extending the E-R model with notions of encapsulation, methods (functions),
and object identity.

4.Semi-structured Data Model. The semi-structured data model permits the


specification of data where individual data items of the same type may have
different sets of attributes. This is in contrast to the data models mentioned
earlier, where every data item of a particular type must have the same set of
attributes. The Extensible Markup Language (XML) is widely used to
represent semi- structured data.

5. Hierarchical Model
The hierarchical data model is one of the oldest data models, developed in
the 1950s by IBM. In this data model, the data is organized in a hierarchical
tree-like structure. This data model can be easily visualized because each
record in DBMS has one parent and many children (possibly 0)
Network Model
A network model is nothing but a generalization of the hierarchical data
model as this data model allows many to many relationships therefore in
this model a record can also have more than one parent.

The network model in DBMS can be represented as a graph and hence it


replaces the hierarchical tree with a graph in which object types are the
nodes and relationships are the edges

TOPIC:ThreeTierschemaArchitectur

(or)

data abstraction or 3 levels view of


data
○ This framework is used to describe the structure of a specific
database system.

○ The three schema architecture is also used to separate the user


applications and physical database.

○ The three schema architecture contains three-levels. It breaks the

database down into three different categories


1. Internal Level(physical schema)

○ The internal level has an internal schema which describes the physical
storage structure of the database.

○ The internal schema is also known as a physical schema.

○ It uses the physical data model. It is used to define that how the data will
be stored in a block.

○ The physical level is used to describe complex low-level data structures in


detail.

2. Conceptual Level:(logical level)


○ The conceptual schema describes the design of a database at the
conceptual level. Conceptual level is also known as logical level.

○ The conceptual schema describes the structure of the whole database.

○ The conceptual level describes what data are to be stored in the database
and also describes what relationship exists among those data.

○ In the conceptual level, internal details such as an implementation of the


data structure are hidden.

○ Programmers and database administrators work at this level.

3. External Level(view level)

○ In the external level, a database contains several schemas that


sometimes called as subschema. The subschema is used to describe the
different view of the database.

○ An external schema is also known as view schema.

○ Each view schema describes the database part that a particular user
group is interested and hides the remaining database from that user
group.

○ The view schema describes the end user interaction with database
sysems.
TOPIC:Database users.
A Database User is defined as a person who interacts with data daily, updating,
reading, and modifying the given data

1. Database Administrator (DBA):

A Database Administrator (DBA) is a person/team who defines the schema and also
controls the database. Database Administrator manages and controls three levels of
database internal level, conceptual level, and external level of Database
management system architecture
→Database Administrator ensures held responsible to maintain integrity and
security of database restricting from unauthorized users. It grants permission to
users of the database and contains a profile of each and every user in the database.

Responsibilities of DBA or function of DBA

2)Application programmers:

These users are computer professionals who write application programs using some
tools. E.g. Software developers
3)Sophisticated users:

These users interact with system without writing program. They form their request
in a database query language.

E.g. Analyst.

4)Parametric End Users : These are unsophisticated who don’t have any
DBMS knowledge but they frequently use the database applications in their
daily life to get the desired results. For example:Clerks in any bank is a
naive user

5)Casual Users / Temporary Users:


Casual Users are the users who occasionally use/access the database but
each time when they access the database they require the new information,
for example, Middle or higher level manager.
6)Specialized users:

Specialized users are sophisticated users who write specialized database


application that does not fit into the traditional data-processing framework.
7)Database Designers

Data Base Designers are the users who design the structure of database
which includes tables, indexes, views, triggers, stored procedures and
constraints which are usually enforced before the database is created or
populated with data

Topic:Instances,Schema,data-independence
Instance:
The collection of information stored in the database at a particular moment is called an
instance

of the database.

Each variable has a particular value at a given instant. The values of the variables in a program
at a point in time correspond to an instance of a database schema.

schema:
The overall design of the database is called the database schema. Schemas are changed
infrequently, if at all. The concept of database schemas and instances can be understood
by analogy to a program written in a programming language.

Database systems have several schemas, partitioned according to the levels of


abstraction. The physical schema describes the database design at the physical level,
while the logical schema describes the database design at the logical level.
Data Independence:
Data independence means a change of data at one level should not affect another
level. Two types of data independence are present in this architecture:
Physical Data Independence: Any change in the physical location of tables and indexes
should not affect the conceptual level or external view of data.

Conceptual Data Independence: The data at conceptual level schema and external
level schema must be independent.Adding or deleting attributes of a table should not
affect the user’s view of the table.

TOPIC: Data Base System Structure


Database Management System is the collection of interrelated data/information or
set of programs that manages, control and access the use of data..
Three Parts that make up the Database System are:
Data Storage Manager
Query Manager:

Disk Storage
• Data Storage Manager
• The storage manager is responsible for managing the storage and retrieval of data on
the disk.
• . It helps us to maintain the integrity and consistency of the database by applying the
constraints.
• It provides an interface between the query processor and the file system, and ensures
the integrity, consistency, security, and efficiency of the database.
• It consists of several subcomponents, such as the authorization manager, the
integrity manager, the transaction manager, the file manager, and the buffer manager
• Authorization manager: checks the permissions of the users to access the data, and
enforces role-based access control.
• Integrity manager: ensures that the data satisfies the integrity constraints, such as
primary keys, foreign keys, or check constraints.
• Transaction manager :controls the concurrent access of the data by multiple users,
and ensures the atomicity, consistency, isolation, and durability (ACID) properties of
the transactions.
• File manager: manages the allocation of space on the disk, and the data structures
used to represent the data, such as records, pages, or segments.
• Buffer manager: manages the transfer of data between the main memory and the
disk

Query Manager:
• Query processor processes the query coming from the user side. Its responsibility
is to manage DML and DDL commands.
• 🡪DDL Interpreter:The DDL interpreter processes data definition language (DDL)
statements, which are used to create or modify the structure of the database objects,
such as tables, indexes, or views
• 🡪DML Compiler:The DML compiler processes data manipulation language (DML)
statements, which are used to insert, delete, or update data in the database.
• 🡪Query Evaluation Engine(Query Optimizer:
• :The query evaluation engine executes the low-level instructions generated by the
DML compiler, using the storage manager to access the data on the disk.
It starts by taking the evaluation plan for the question, runs it, and then returns the

result. Simply said, the query evaluation engine evaluates the SQL commands used
to

access the database's contents before returning the result of the query
Disk Storage
• A DBMS can use various kinds of Data Structures as a part of physical system
implementation in the form of disk storage.
• Data Dictionary:Data Dictionary − Store all the queries. Queries are checked
according to the SQL configuration, if the queries are valid ok. Otherwise, it
generates errors.
• Indices:

These indices are used to access and retrieve the data in a very fast and efficient way.
Database users:
1)Application programmers:

These users are computer professionals who write application programs using some tools.
E.g. Software developers

2)Sophisticated users:

These users interact with system without writing program. They form their request in a
database query language.

Topic: Centralized and Client Server architecture


for DataBase
The primary processing for all system functions, including user application programs,
user interface programs, and all DBMS capabilities, was handled by mainframe
computers in earlier systems.

The primary cause of this was that the majority of users accessed such systems using
computer terminals with limited processing power and merely display capabilities. Only
display data and controls were delivered from the computer system to the display
terminals, which were connected to the central node by a variety of communications
networks, while all processing was done remotely on the computer system.

The majority of users switched from terminals to PCs and workstations as hardware
prices decreased.. As a result, the DBMS itself continued to operate as a centralized
DBMS, where all DBMS functionality, application program execution, and UI
processing were done on a single computer

Client-server Architecture of DBMS:


Client-server architecture is a fundamental concept in system design where a network
involves multiple clients and a server. Clients are devices or programs that request
services or resources, while the server is a powerful machine providing these resources
or services.
Two-Tier Client Server Architecture:

Two-Tier Architecture: In this model, clients communicate directly with the database
server. The client handles the presentation logic, and the server manages the database
operations.

Three-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.
Topic:Entity Relationship Model:

• ER-Diagram is a pictorial representation of data that describes how data is


communicated and related to each other. Any object, such as entities, attributes of an
entity, sets of relationship, and other attributes of relationship, can be characterized
with the help of the ER diagram
Symbols/Notations Used in ER Model
ER Model is used to model the logical view of the system from a data perspective
which consists of these symbols:

The Building Blocks of an Entity–Relationship Diagram


• Rectangles: Rectangles represent Entities in ER Model.
• Ellipses: Ellipses represent Attributes in ER Model.
• Diamond: Diamonds represent Relationships among Entities.
• Lines: Lines represent attributes to entities and entity sets with other relationship
types.
• Double Ellipse: Double Ellipses represent Multi-Valued Attributes.
• Double Rectangle: Double Rectangle represents a Weak Entity.


Representation of Entities:
• Entities: An entity may be any object, class, person or place.They are represented
using the rectangle-shaped box. These rectangles are named with the entity set they
represent.
Entity Set: An Entity is an object of Entity Type and a set of all entities is called an
entity set. For Example, E1 is an entity having Entity Type Student and the set of all
students is called Entity Set.

Classification of Entity Sets Entity sets can be broadly classified into:


1. Strong entity. 2. Weak entity.
1. Strong Entity Strong Entity
The Strong Entity is the one whose existence does not depend on the existence of any
other entity in a schema. It is denoted by a single rectangle. A strong entity always
has the primary key in the set of attributes that describes the strong entity. Set of
similar types of strong entities together forms the Strong Entity Set. A strong entity
holds the relationship with the weak entity via an Identifying Relationship.

2. Weak Entity

A Weak entity is the one that depends on its owner entity i.e. a strong entity for its
existence. A weak entity is denoted by the double rectangle. Weak entity do not
have the primary key instead it has a partial key that uniquely discriminates the
weak entities. The primary key of a weak entity is a composite key formed from
the primary key of the
strong entity and partial key of the weak entity. The collection of similar weak
entities is called Weak Entity Set. The relationship between a weak entity and a
strong entity is always denoted with an Identifying Relationship i.e. double
diamond.
For Example, A company may store the information of dependents (Parents, Children,
Spouse) of an Employee. But the dependents don’t have existed without the employee.
So Dependent will be a Weak Entity Type and Employee will be Identifying Entity
type for Dependent, which means it is Strong Entity Type.
A weak entity type is represented by a Double Rectangle. The participation of weak
entity types is always total. The relationship between the weak entity type and its
identifying strong entity type is called identifying relationship and it is represented by
a double diamond.

Strong Entity and Weak Entity

Representation of Attributes
2)Attributes
Attributes are the properties that define the entity type. For example, Roll_No, Name,
DOB, Age, Address, and Mobile_No are the attributes that define entity type Student.
In ER diagram, the attribute is represented by an oval.
1. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called the key
attribute. For example, Roll_No will be unique for each student. In ER diagram, the
key attribute is represented by an oval with underlying lines.
2. Composite Attribute
An attribute composed of many other attributes is called a composite attribute. For
example, the Address attribute of the student Entity type consists of Street, City, State,
and Country. In ER diagram, the composite attribute is represented by an oval
comprising of ovals.

3. Multivalued Attribute
An attribute consisting of more than one value for a given entity. For example,
Phone_No (can be more than one for a given student). In ER diagram, a multivalued
attribute is represented by a double oval.

4. Derived Attribute
An attribute that can be derived from other attributes of the entity type is known as a
derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, the derived
attribute is represented by a dashed oval.

The Complete Entity Type Student with its Attributes can be represented as:
5.Single valued Attributes: If an attribute can take only a single value for each entity
instance, it is a single valued attribute. example for single valued attribute : age of a
student. It can take only one value for a particular student.
6.Simple attribute If an attribute cannot be divided into simpler components, it is a
simple attribute. Example for simple attribute : employee_id of an employee

3)Relationship Type and Relationship Set


A Relationship Type represents the association between entity types. For example,
‘Enrolled in’ is a relationship type that exists between entity type Student and Course.
In ER diagram, the relationship type is represented by a diamond and connecting the
entities with lines.

Entity-Relationship Set
A set of relationships of the same type is known as a relationship set. The following
relationship set depicts S1 as enrolled in C2, S2 as enrolled in C1, and S3 as registered
in C3.

Degree of a Relationship Set


The number of different entity sets participating in a relationship set is called the
degree of a relationship set.
Types of Relationship sets

1. Unary Relationship: When there is only ONE entity set participating in a


relation, the relationship is called a unary relationship. For example, one person is
married to only one person.

Unary Relationship
Roles and Recursive Relation: When an entity sets appear in more than one
relationship, it is useful to add labels to connecting lines. These labels are called as
roles. Example In this example, Husband and wife are referred as roles

2.Binary Relationship: When there are TWO entities set participating in a


relationship, the relationship is called a binary relationship. For example, a Student is
enrolled in a Course.

3)Ternary Relationship Set:


Ternary relationship set is a relationship set where three entity sets participate in a
relationship set

4)n-ary Relationship: When there are n entities set participating in a relation, the
relationship is called an n-ary relationship.

Cardinality Ratios
The number of times an entity of an entity set participates in a relationship set is
known as cardinality. Cardinality can be of different types:
1. One-to-One: When each entity in each entity set can take part only once in the
relationship, the cardinality is one-to-one. Let us assume that a male can marry one
female and a female can marry one male. So the relationship will be one-to-one. the
total number of tables that can be used in this is 2.

One-to-One Cardinality
Using Sets, it can be represented as:

Set Representation of One-to-One


2,One-to-Many: In one-to-many mapping as well where each entity can be related to
more than one relationship and the total number of tables that can be used in this is 2.
3.Many-to-One: When entities in one entity set can take part only once in the
relationship set and entities in other entity sets can take part more than once in the
relationship set, cardinality is many to one..

4.Many-to-Many: In this type of cardinality mapping, an entity in A is


associated with any number of entities in B, and an entity in B is associated
with any number of entities in A.
So the relationship will be many to many. the total number of tables that can be used
in this is 3.

TOPIC: CONSTRAINTS ON RELATIONSHIP


In a Relationship, Participation constraint specifies the presence of an entity when it is
related to another entity in a relationship
• There are two types of Participation constraint:
• Total participation
• Partial participation
Total participation constraint
• It specifies that each entity present in the entity set must mandatorily participate in at
least one relationship instance of that relationship set,for this reason, it is also called
as mandatory participation
• It is represented using a double line between the entity set and relationship set


specifies that each student must be enrolled in at least one course where the “student”
is the entity set and relationship “enrolled in”

2)Partial participation
• It specifies that each entity in the entity set may or may not participate in the
relationship instance of the relationship set, is also called as optional
participation

• It is represented using a single line between the entity set and relationship set in
the ER diagram

Topic :subclass, super class


1. Superclass and Subclass:
○ Superclass: The parent table from which attributes are inherited.
○ Subclass: The child table that inherits attributes from the superclass
A subclass is a class derived from the superclass. It inherits the properties of the
superclass and also contains attributes of its own. An example is:

Car, Truck and Motorcycle are all subclasses of the superclass Vehicle. They all inherit
common attributes from vehicle such as speed, colour etc. while they have different
attributes also i.e Number of wheels in Car is 4 while in Motorcycle is 2.

Superclasses
A superclass is the class from which many subclasses can be created. The
subclasses inherit the characteristics of a superclass. The superclass is also known as
the parent class or base class.

In the above example, Vehicle is the Superclass and its subclasses are Car, Truck and
Motorcycle.

Inheritance
Inheritance is basically the process of basing a class on another class i.e to build a class
on a existing class. The new class contains all the features and functionalities of the old
class in addition to its own.

The class which is newly created is known as the subclass or child class and the original
class is the parent class or the superclass.
Inheritance is an important feature of Generalization and Specialization. It allows
lower-level entities to inherit the attributes of higher-level entities.

Topic:Generalization and Specialization


Generalization is the process of extracting common properties from a set of entities and
creating a generalized entity from it.
It is a bottom-up approach in which two or more entities can be generalized to a
higher-level entity if they have some attributes in common
.It is a form of abstraction that specifies two or more entities (sub class) having
common characters that can be generalized into one single entity (super class) at higher
level hiding all the differences.

We can have three sub entities as Car, Truck, Motorcycle and these three entities can be
generalized into one general super class as Vehicle.

Specialization
In specialization, an entity is divided into sub-entities based on its characteristics. It is a
top-down approach where the higher-level entity is specialized into two or more
lower-level entitiesIt breaks an entity into multiple entities from higher level (super
class) to lower level (sub class). The breaking of higher level entity is based on some
distinguishing characteristics of the entities in super class.

It is a top down approach in which we first define the super class and then sub class and
then their attributes and relationships.Specialization is the opposite of generalization. In
specialization, a group of entities is divided into sub groups based on their
characteristics.

Example, an EMPLOYEE entity in an Employee management system can be


specialized into DEVELOPER, TESTER, etc. as shown in Figure 2. In this case,
common attributes like E_NAME, E_SAL, etc. become part of a higher entity
(EMPLOYEE), and specialized attributes like TES_TYPE become part of a specialized
entity (TESTER).
Specialization is also called as ” Top-Down approch”.

You might also like