0% found this document useful (0 votes)
129 views5 pages

Lab03 Sol

The document discusses many-to-many relationships in ER diagrams and how they must be transformed for implementation in relational databases. It provides an example of a video rental database with a many-to-many relationship between customers and tapes, and how this is decomposed into two one-to-many relationships using a composite rental entity. The document also contains questions and answers about ER modeling concepts.

Uploaded by

Blackk Worldz
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)
129 views5 pages

Lab03 Sol

The document discusses many-to-many relationships in ER diagrams and how they must be transformed for implementation in relational databases. It provides an example of a video rental database with a many-to-many relationship between customers and tapes, and how this is decomposed into two one-to-many relationships using a composite rental entity. The document also contains questions and answers about ER modeling concepts.

Uploaded by

Blackk Worldz
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/ 5

Database Fundamental (TIS 1101)

Tutorial 3

Q1. How are many to many relationships (M:N) addressed in the development of an
E-R diagram? Give an example of a M:N relationship and explain how it is
addressed for an internal model.

Although M:N relationships may properly be viewed in a conceptual model, you


cannot directly implement them in an RDBMS and hence they have to be
modified for the internal model. Therefore, an M:N relationship must be
decomposed into two 1:M relationships, centered upon a composite entity.

For example: a video rental database can have the same tape being rented by
many customers, and the same customer renting many tapes.
M N
CUSTOMER rents TAPE

Conceptual Model

Note that the O is only next to customer because when the video rental company
buys a new tape, it hasn’t been yet rented by any customer but they already
must enter it into the database. However, they don’t enter a new person into
their database until that person actually becomes a customer by renting a tape.

This M:N relationship must be transformed into 2 1:M relationships with a


composite entity in the middle:

1 M M 1
CUSTOMER RENTAL TAPE

(1,N) (1,1) (1,1) (0,N)

Internal Model
Note that the O now is on the side of RENTAL going to TAPE. The CUSTOMER
record only gets created when he rents a TAPE. So a CUSTOMER must have a
relationship with RENTAL. Whereas the TAPE record was created before anyone
rented it. So the association with RENTAL is optional.

Q2. What is the difference between a composite key, a composite attribute and a
composite entity?

A composite key is a key that consists of more than one attribute.


Example: (stu_LName, stu_FName, stu_Iinit, stu_Phone)  stu_Hrs

A composite attribute is an attribute which can be further subdivided to yield


additional attributes
Example: address  city, street, state, zip code

A composite entity, also known as the bridge entity, is used as a bridge to break
M:N relationships into two sets of 1:M relationships.
Q3. What is a derived attribute and how it is represented in the Chen’s model?

A derived attribute is an attribute whose value can be calculated from another


attribute. For example, age (current date (year) – date of birth (year)). This
attribute is not physically stored in the database.

In the Chen’s model, derived attribute is represented as a dashed to the entity.

Q4. Explain briefly the THREE data abstraction levels.

External model – represents the user’s view of the data environment

Conceptual model – represents the global view of the entire organization


data. It integrates all the external models into a single global view

Internal model – is the representation of the database as seen by the


DBMS.
Q5. Draw a Chen diagram and a Crowfoot diagram based on the following
diagram:

Crowfoot

** Note to tutor: If time permits, can expose student to insert table such as.
Create databse dbStudent

Connect to dbStudent

create table STUDENT


(
student_id int,
name varchar(30),
age int,
gender char(1)
);

Insert into student values (100, ‘Abu’, 20, ‘M’);


Insert into student values (101, ‘Ali’, 25, ‘M’);
Insert into student values (101, ‘Aminah’, 22, ‘F’);

You might also like