0% found this document useful (0 votes)
4 views4 pages

Unit 2

The document discusses the Entity-Relationship Diagram (ERD) model and relational model, covering components such as entities, attributes, relationships, and keys. It includes case studies on university and e-commerce systems, as well as the conversion of ER diagrams to relational models and normalization processes. Additionally, it provides examples of relational models in library and hospital systems.

Uploaded by

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

Unit 2

The document discusses the Entity-Relationship Diagram (ERD) model and relational model, covering components such as entities, attributes, relationships, and keys. It includes case studies on university and e-commerce systems, as well as the conversion of ER diagrams to relational models and normalization processes. Additionally, it provides examples of relational models in library and hospital systems.

Uploaded by

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

Unit 2

ERD model and relational model

2.1 Components of ERD model 2.2 Case Studies on ER model 2.3 Terms -
Relation, Tuple, Attribute, Mapping Cardinality 2.4 Keys - Super Key ,
Candidate Key, Primary Key, Foreign Key 2.5 Conversion of ER Diagram to
Relational Model 2.6 Conversion of relational schema to 3NF 2.7 Case
Studies on Relational Model

2.1 Components of ERD Model

The Entity-Relationship Diagram (ERD) is a visual representation of data


and relationships between entities in a system. The core components are:

1. Entities: Objects or things in the system that can be distinctly


identified. They are represented by rectangles.

o Types:

 Strong Entity: Can exist independently (e.g.,


Employee).

 Weak Entity: Depends on a strong entity (e.g.,


OrderDetails linked to Orders).

2. Attributes: Properties or details about an entity, shown as ovals.

o Types:

 Simple: Cannot be broken down (e.g., Age).

 Composite: Composed of multiple sub-parts (e.g.,


FullName = FirstName + LastName).

 Derived: Computed from other attributes (e.g., Age


derived from DateOfBirth).

 Multivalued: Can have multiple values (e.g.,


PhoneNumbers).

3. Relationships: Associations between entities, represented by


diamonds.

o Types:

 1:1 (One-to-One): A single instance of one entity


relates to a single instance of another.

 1:N (One-to-Many): One instance of an entity relates


to many of another.
 M:N (Many-to-Many): Many instances of one entity
relate to many instances of another.

4. Cardinality: Specifies the number of entities involved in the


relationship (e.g., mandatory or optional).

5. Keys: Unique identifiers for entities (Primary keys in the relational


context).

2.2 Case Studies on ER Model

1. University System:

o Entities: Student, Course, Professor.

o Relationships: Enrollment (Student and Course), Teaches


(Professor and Course).

o Attributes: Student (StudentID, Name), Course (CourseID,


Title), etc.

2. E-commerce System:

o Entities: Customer, Order, Product, Supplier.

o Relationships: Purchases (Customer to Order), Contains (Order


to Product).

o Attributes: Customer (CustomerID, Address), Product


(ProductID, Price).

2.3 Terms

1. Relation: A table in a relational database.

2. Tuple: A single row in a relation, representing a set of related data.

3. Attribute: A column in a relation, representing a characteristic or


property of the data.

4. Mapping Cardinality: Specifies the number of associations


between entities (e.g., 1:1, 1:N, M:N).

2.4 Keys

1. Super Key: Any set of attributes that can uniquely identify a tuple.

2. Candidate Key: A minimal super key with no redundant attributes.


3. Primary Key: A chosen candidate key that uniquely identifies
tuples in a relation.

4. Foreign Key: An attribute in one relation that refers to the primary


key in another relation, establishing a link.

2.5 Conversion of ER Diagram to Relational Model

1. Entities: Each entity becomes a relation (table), and its attributes


become columns.

2. Relationships:

o 1:1: Add the primary key of one entity as a foreign key to the
other.

o 1:N: Add the primary key of the "one" side as a foreign key to
the "many" side.

o M:N: Create a new relation for the relationship, including


foreign keys from both entities.

3. Attributes:

o Multivalued attributes become separate relations.

o Composite attributes are flattened into their basic


components.

2.6 Conversion of Relational Schema to 3NF (Third Normal Form)

1. First Normal Form (1NF):

o Remove repeating groups; ensure each cell contains atomic


(indivisible) values.

2. Second Normal Form (2NF):

o Remove partial dependency (attributes depend on a part of a


composite key); ensure full dependency on the primary key.

3. Third Normal Form (3NF):/

o Remove transitive dependency (attributes depend on non-


prime attributes); ensure dependency is only on the primary
key.
2.7 Case Studies on Relational Model

1. Library Management System:

o Tables: Books(BookID, Title, AuthorID), Authors(AuthorID,


Name), Borrowers(BorrowerID, Name), Loans(LoanID, BookID,
BorrowerID, LoanDate).

o Relationships: Books-Authors (1:N), Books-Loans (1:N).

2. Hospital System:

o Tables: Patient(PatientID, Name), Doctor(DoctorID, Specialty),


Appointment(AppointmentID, PatientID, DoctorID, Date).

o Relationships: Patients-Doctors (M:N via Appointments).

You might also like