5-Entity Types and Entity Set
5-Entity Types and Entity Set
Topics To Be Covered
In This Lecture
• Entity/Relationship models
• Entities and Attributes
• Relationships
• Attributes
• E/R Diagrams
Component of ERD
Entity = An entity may be an object with physical
existence (for example, a particular person, car, house or
employee) or it may be a conceptual existence (for
example a particular company, a job, a university
course).
One-To-Many Relationships
A one-to-many relationship is the most common
type of relationship. In this type of relationship, a
row in table A can have many matching rows in
table B, but a row in table B can have only one
matching row in table A.
Many-To-Many Relationships
In a many-to-many relationship, a row in table A can
have many matching rows in table B, and vice versa. You
create such a relationship by defining a third table, called
a junction table, whose primary key consists of the
foreign keys from both table A and table B.
One-To-One Relationships
In a one-to-one relationship, a row in table A can have no
more than one matching row in table B, and vice versa. A
one-to-one relationship is created if both of the related
columns are primary keys or have unique constraints.
Derived Attribute:
The attribute which actually doesn’t exist but is driven on the basis of pre-exist data, e.g. DOB is
entered instead of age.
Multivalued Attribute:
Multivalued Attribute consist of more than one value. For example one person may not have a
college degree, another person may have two college degrees, and a third person may have three
college degree.
Tuples:
Row are known as tuple
Cardinality:
No of rows or tuples is known as cardinality.
Degree:
No of attribute are known as degree.
Conceptual design
• Build a model independent of the choice of DBMS
Logical design
Create the database in a given DBMS
• Physical design
• How the database is stored in hardware
Example
Relationship Type:
Is the schema description of a relationship
Identifies the relationship name and the participating entity types
Also identifies certain relationship constraints
Relationship Set:
The current set of relationship instances represented in the database
The current state of a relationship type
Relationship types and instances
Slide
3- 35 Relationship type vs. relationship set (2)
In the refined design, some attributes from the initial entity types are refined into
relationships:
Manager of DEPARTMENT -> MANAGES
Works_on of EMPLOYEE -> WORKS_ON
Department of EMPLOYEE -> WORKS_FOR
etc
In general, more than one relationship type can exist between the same
participating entity types
MANAGES and WORKS_FOR are distinct relationship types between EMPLOYEE
and DEPARTMENT
With different meanings and different relationship instances.
Slide
3- 39 Recursive Relationship Type
A number of popular tools that cover conceptual modeling and mapping into
relational schema design.
Examples: ERWin, S- Designer (Enterprise Application Suite), ER- Studio, etc.
POSITIVES:
Serves as documentation of application requirements, easy user interface - mostly
graphics editor support
NEGATIVES:
Most tools lack a proper distinct notation for relationships with relationship
attributes
Mostly represent a relational design in a diagrammatic form rather than a conceptual
ER-based design
(See Chapter 12 for details)
Some of the Currently Available
Slide
3- 63 Automated Database Design Tools
COMPANY TOOL FUNCTIONALITY
Embarcadero ER Studio Database Modeling in ER and IDEF1X
Technologies
DB Artisan Database administration, space and security management
Rational (IBM) Rational Rose UML Modeling & application generation in C++/JAVA
Resolution Ltd. Xcase Conceptual modeling up to code maintenance
Sybase Enterprise Application Suite Data modeling, business logic modeling
Visio Visio Enterprise Data modeling, design/reengineering Visual Basic/C++
Slide
3- 64 Extended Entity-Relationship (EER) Model (in
next chapter)
The entity relationship model in its original form did not support the specialization and
generalization abstractions
Next chapter illustrates how the ER model can be extended with
Type-subtype and set-subset relationships
Specialization/Generalization Hierarchies
Notation to display them in EER diagrams
Slide
3- 65 Chapter Summary