Database Management System (Data Modelling) Answer Key - Activity 2
Database Management System (Data Modelling) Answer Key - Activity 2
PART 1:
1. Discuss the importance of data modeling.
A noun in a business rule will generally translate into an entity in the model, and
a verb (active or passive) associating nouns will translate into a relationship among the
entities. The business rule "a customer can generate several invoices" for example,
contains two nouns (customer and invoice) and a verb ("generate") that links them.
From this business rule, you could deduce that:
INFORMATION MANAGEMENT - ASSIGNMENT
Customer and invoice are objects of interest for the environment and should be
represented by their respective entities.
There is a “generate” relationship between customer and invoice.
To properly identify the type of relationship, you should consider that relationships
are bidirectional; that is, they go both ways. For example, the business rule “a customer
may generate many invoices” is complemented by the business rule “an invoice is
generated by only one customer.” In that case, the relationship is one-to-many (1:M).
Customer is the “1” side, and invoice is the “many” side.
4. What languages emerged to standardize the basic network data model, and why was such
standardization important to users and designers?
The subschema, which defines the portion of the database “seen” by the
application programs that actually produce the desired information from the data
contained within the database.
Standardization is important to users and designers because it allows them to shift from
one commercial application to another with little trouble when they operate at the logical level.
5. Describe the basic features of the relational data model and discuss their importance to the
end user and the designer.
A relational database is a single data repository that retains conceptual simplicity while
providing structural and data independence. The user perceives the relational database model
as a collection of tables in which data is stored. Each table is made up of rows and columns,
just like a matrix. Tables are related to each other because one of their columns has a shared
common value.
The relational model is a game-changer for users and designers because it allows them
to work in a simpler conceptual environment. End users like to visualize their data as a
collection of data structured into a matrix. Designers prefer conceptual data representation
because it relieves them of the complexities associated with physical data representation.
6. Explain how the entity relationship (ER) model helped produce a more structured relational
database design environment.
INFORMATION MANAGEMENT - ASSIGNMENT
The entity relationship helped produce more structured relational database design by
making it easier to examine structures graphically rather than in text, the ER model has become
widely accepted standard for modeling. It quickly became popular because it complemented the
relational model concepts. The two combined to provide the foundation for tightly structured
database design.
7. Use the scenario described by “A customer can make many payments, but each payment is
made by only one customer” as the basis for an entity relationship diagram (ERD)
representation.
An object-oriented data model (OODM) reflects a very different way to define and use
entities. It is described by its factual content and unlike an entity, an object includes information
about relationships between the facts within the object, as well as information about its
relationships with other objects. Therefore, the facts within the object are given greater
meaning. The OODM is said to be a semantic data model because semantic indicates meaning.
9. What is the difference between an object and a class in the object-oriented data model
(OODM)?
10. How would you model Question 7 with an OODM? (Use Figure 2.4 as your guide.)
11. What is an ERDM, and what role does it play in the modern (production) database
environment?
INFORMATION MANAGEMENT - ASSIGNMENT
12. In terms of data and structural independence, compare file system data management with
the five data models discussed in this chapter.
One-to-one: An academic department is chaired by one professor; a professor may chair only
one academic department.
One-to-many: A customer may generate many invoices; each invoice is generated by one
customer.
Many-to-many: An employee may have earned many degrees; a degree may have been
earned by many employees.
15. What is a table, and what role does it play in the relational model?
The relational data model, strictly speaking, is based on relations for data storage. The
algebraic set theory underpins these relationships. The consumer, on the other hand, sees the
relationships as tables. Designers and users in the relational database world see a table as a
matrix made up of a series of row/column intersections. Tables, also known as relations, are
connected together because they share a common entity characteristic. For example, a
customer number in the INVOICE table points to the same number in the CUSTOMER table.
The RDBMS will use this function to connect invoices to the customers who generated them.
It's particularly useful from a modeling and implementation perspective. Tables provide
an easy way to summarize entity characteristics and relationships among entities since they are
used to describe the entities they represent. Furthermore, since they are merely conceptual
structures, the designer does not need to be concerned with the database design's physical
implementation.
17. What is logical independence? In this example, the CUSTOMER represents the “many”
side because an AGENT can have many CUSTOMERs.
The AGENT represents the “1” side because each
CUSTOMER has only one AGENT.
INFORMATION MANAGEMENT - ASSIGNMENT
Logical data independence is the one which has power (ability) to change logical
schema without changing external schema or application. Logical data independence in
any database applications relate to views where we can only view the data rather than
modifying data.
Example:
Adding or removing entities, relationships, attributes, to conceptual schema is possible
without doing or performing any alteration in the external schemas or records. Renaming
attributes or tables does not affect any change in external schema.
In the figure, the business rule that an advisor can advise many students and a student
has only one assigned advisor is shown with in a relationship with a connectivity of 1:M. The
business rule that a student can register only one vehicle to park on campus and a vehicle can
be registered by only one student is shown with a relationship with a connectivity of 1:1. Finally,
the rule that a student can register for many classes, and a class can be registered for by many
students, is shown by the relationship with a connectivity of M:N.
INFORMATION MANAGEMENT - ASSIGNMENT
Problem Solutions:
Use the contents of Figure 2.1 to work problems 1-3.
1. Write the business rule(s) that governs the relationship between AGENT and CUSTOMER.
Given the data in the two tables, you can see that an AGENT – through AGENT_CODE -- can
occur many times in the CUSTOMER table. But each customer has only one agent. Therefore,
the business rules may be written as follows:
Chen’s ERD:
3. Using the ERD you drew in Problem 2, create the equivalent Object representation and UML
class diagram. (Use Figure 2.4 as your guide.)
The OO model
Using Figure P2.4 as your guide, work Problems 4–5. The DealCo relational diagram shows the
initial entities and attributes for the DealCo stores, located in two regions of the country.
INFORMATION MANAGEMENT - ASSIGNMENT
4. Identify each relationship type and write all of the business rules.
One region can be the location for many stores. Each store is located in only one region.
Therefore, the relationship between REGION and STORE is 1:M.
Each store employs one or more employees. Each employee is employed by one store.
(In this case, we are assuming that the business rule specifies that an employee cannot
work in more than one store at a time.) Therefore, the relationship between STORE and
EMPLOYEE is 1:M.
A job – such as accountant or sales representative -- can be assigned to many
employees. (For example, one would reasonably assume that a store can have more
than one sales representative. Therefore, the job title “Sales Representative” can be
assigned to more than one employee at a time.) Each employee can have only one job
assignment. (In this case, we are assuming that the business rule specifies that an
employee cannot have more than one job assignment at a time.) Therefore, the
relationship between JOB and EMPLOYEE is 1:M. Note. These are assumptions prior in
mind the setting.
Using Figure P2.6 as your guide, work Problems 6−8 The Tiny College relational diagram
shows the initial entities and attributes for Tiny College.
The simplest way to illustrate the relationship between ENROLL, CLASS, and STUDENT is to
discuss the data shown in Table P2.6. As you examine the Table P2.6 contents and compare
the attributes to relational schema shown in Figure P2.6, note these features:
Business Rules:
All of the relationships are 1:M. The relationships may be written as follows:
COURSE generates CLASS. One course can generate many classes. Each class is
generated by one course.
CLASS is referenced in ENROLL. One class can be referenced in enrollment many
times. Each individual enrollment references one class. Note that the ENROLL entity is
also related to STUDENT. Each entry in the ENROLL entity references one student and
the class for which that student has enrolled. A student cannot enroll in the same class
more than once. If a student enrolls in four classes, that student will appear in the
ENROLL entity four times, each time for a different class.
STUDENT is shown in ENROLL. One student can be shown in enrollment many times.
(In database design terms, “many” simply means “more than once.”) Each individual
enrollment entry shows one student.
8. Create the UML class diagram that reflects the entities and relationships you identified in the
relational diagram.
The OO Model for Tiny College
9. Typically, a patient staying in a hospital receives medications that have been ordered by a
particular doctor. Because the patient often receives several medications per day, there is a 1:M
relationship between PATIENT and ORDER. Similarly, each order can include several
medications, creating a 1:M relationship between ORDER and MEDICATION.
a. Identify the business rules for PATIENT, ORDER, and MEDICATION.
b. Create a Crow's Foot ERD that depicts a relational database model to capture these
business rules.
Crow's foot ERD for Problem 9
INFORMATION MANAGEMENT - ASSIGNMENT
10. United Broke Artists (UBA) is a broker for not-so-famous painters. UBA maintains a small
network database to track painters, paintings, and galleries. A painting is painted by a particular
artist, and that painting is exhibited in a particular gallery. A gallery can exhibit many paintings,
but each painting can be exhibited in only one gallery. Similarly, a painting is painted by a
single painter, but each painter can paint many paintings. Using PAINTER, PAINTING, and
GALLERY, in terms of a relational database:
a. What tables would you create, and what would the table components be?
We would create the three tables shown in Figure P2.10a. (Use the teacher’s Ch02_UBA
database in your instructor's resources to illustrate the table contents.)
As you discuss the UBA database contents, note in particular the following business
rules that are reflected in the tables and their contents:
INFORMATION MANAGEMENT - ASSIGNMENT
They all work back together by means of the painter paints the painting that is present in
a gallery. The gallery where the painting is present can only be one. Therefore, a painter can
have a painting inside the gallery or a gallery could have a painting painted by a painter.
11. Using the ERD from Problem 10, create the relational schema. (Create an appropriate
collection of attributes for each of the entities. Make sure you use the appropriate naming
conventions to name the attributes.)
12. Convert the ERD from Problem 10 into the corresponding UML class diagram.
13. Describe the relationships (identify the business rules) depicted in the Crow’s Foot ERD
shown in Figure P2.13.
The Crow’s Foot ERD for Problem 13
14. Create a Crow’s Foot ERD to include the following business rules for the ProdCo company:
The Crow’s Foot ERD for ProdCo company. Note that a 1:M relationship is always read from
the one (1) to the many (M) side. Therefore, the customer-invoice relationship is read as “one
customer generates many invoices.”
INFORMATION MANAGEMENT - ASSIGNMENT
15. Write the business rules that are reflected in the ERD shown in Figure P2.15. (Note that the
ERD reflects some simplifying assumptions. For example, each book is written by only one
author. Also, remember that the ERD is always read from the “1” to the “M” side, regardless of
the orientation of the ERD components.)
This ERD will be a good basis for a discussion about what happens when more realistic
assumptions are made. For example, a book – such as this one – may be written by more than
one author. Therefore, a contract may be signed by more than one author. Your students will
learn how to model such relationships after they have become familiar with the material in
Chapter 3.
16. Create a Crow’s Foot ERD for each of the following descriptions. (Note: The word many
merely means “more than one” in the database modeling environment.)
INFORMATION MANAGEMENT - ASSIGNMENT
As you discuss the contents of this figure. Note the 1:1 relationship between the
EMPLOYEE and the DEPARTMENT in the “manages” relationship and the 1:M
relationship between the DEPARTMENT and the EMPLOYEE in the “is assigned to”
relationship.
During some period of time, a customer can rent many videotapes from the BigVid store.
Each of the BigVid’s videotapes can be rented to many customers during that period of
time.
The solution is presented in Figure P2.16b. Note the M:N relationship between
CUSTOMER and VIDEO. Such a relationship is not implementable in a relational model.
b. During some period of time, a customer can rent many videotapes from the BigVid store.
Each of BigVid’s videotapes can be rented to many customers during that period of time.
The BigVid Crow’s Foot ERD
ERD into an implementable ERD, add the third RENTAL entity to create a 1:M relationship
between CUSTOMER and RENTAL and a 1:M relationship between VIDEO and RENTAL.
INFORMATION MANAGEMENT - ASSIGNMENT
c. An airliner can be assigned to fly many flights, but each flight is flown by only one airliner.
The Airline Crow’s Foot ERD
d. The KwikTite Corporation operates many factories. Each factory is located in a region. Each
region can be “home” to many of KwikTite’s factories. Each factory employs many employees,
but each of those employees is employed by only one factory.
The KwikTite Crow’s Foot ERD
e. An employee may have earned many degrees, and each degree may have been earned by
many employees.
The Earned Degree Crow’s Foot ERD
1:M relationship