Problem Set Activity No.3

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

DELGADO, ANDREI MANUEL L./ RIÑOZA, VINCENT KYLE T.

09/01/2020

CHAPTER 3: THE RELATIONAL DATABASE MODEL

A. REVIEW QUESTIONS

1. What is the difference between a database and a table?


A database is a collection of organized data that is composed of tables and
indexes.
Table on the other hand, is a 2D structure with rows and columns that stores data,
information and records.
2. What does it mean to say that a database displays both entity integrity and
referential integrity?
A database possessing an entity integrity means that each of its row in the table
has its own unique identity and a referential integrity displays a condition in which a
foreign key value has a match or is referring to an existing valid tuple in the
corresponding table or a row in another relation.
3. Why are entity integrity and referential integrity important in a database?
Entity integrity is important in database because if you are referencing and
searching for a specific row in a table, it will always give you correct results.
Referential integrity is also important because it ensures that only a valid foreign key
can be assigned to a table. You cannot add an invalid value to the related table which
eliminates possible data entry errors that you might make.
4. What are the requirements that two relations must satisfy to be considered union-
compatible?
They should have the same number of attributes and the columns must share the
similar or compatible domain.
5. Explain why the data dictionary is sometimes called “the database designer’s
database”.
A data dictionary contains a detailed accounting of all the tables found within the
user/designer-created database with metadata, and it contains all the attribute
names and characteristics for each table in the system.
6. Identify and describe the components of the table shown in the figure below, using
correct terminology. Use your knowledge of naming conventions to identify the
table’s probable foreign key(s).

 Entity name: EMPLOYEE


 No. Of Entities: Ten (10)
 Attributes: EMP_NUM, EMP_LNAME, EMP_INITIAL, EMP_FNAME, DEPT_CODE,
JOB_CODE.

ASST. PROF. RONINA C. TAYUAN 1


DELGADO, ANDREI MANUEL L./ RIÑOZA, VINCENT KYLE T. 09/01/2020

 Primary Key: EMP_NUM


 Foreign Keys: DEPT_CODE, JOB_CODE
Figure 6.1: The Ch03_NoComp Database EMPLOYEE Table

Use the database composed of the two tables shown in Figure 7.1 to answer questions
7-10.

Figure 7.1: The Ch03_Theater Database Tables

7. Identify the primary keys.


In the DIRECTOR table, the primary key is DIR_NUM. In PLAY table, the primary key is
PLAY_CODE.
8. Identify the foreign keys.
The foreign key in PLAY table is DIR_NUM.
9. Create the ERD.

ASST. PROF. RONINA C. TAYUAN 2


DELGADO, ANDREI MANUEL L./ RIÑOZA, VINCENT KYLE T. 09/01/2020

10. Create the relational diagram to show the relationship between DIRECTOR and PLAY.

ASST. PROF. RONINA C. TAYUAN 3


DELGADO, ANDREI MANUEL L./ RIÑOZA, VINCENT KYLE T. 09/01/2020

B. PROBLEM SOLUTIONS

Use the database shown in Figure 3.1B to answer Problems 1-9.

Figure 3.1B: The Ch03_StoreCo Database Tables

1. For each table, identify the primary key and the foreign key(s). If a table does not
have a foreign key, write None in the space provided.

ASST. PROF. RONINA C. TAYUAN 4


DELGADO, ANDREI MANUEL L./ RIÑOZA, VINCENT KYLE T. 09/01/2020

EMPLOYEE Primary Key: EMP_CODE


STORE Primary Key: STORE_CODE
REGION Primary Key: REGION_CODE
EMPLOYEE Foreign Key: STORE_CODE
STORE Foreign Keys: REGION_CODE and EMP_CODE
REGION Foreign Key: None
2. Do the tables exhibit entity integrity? Answer yes or no and then explain your answer.
Yes, the tables do exhibit entity integrity as each of the table’s keys for the
employee, store and region (specifically the EMP_CODE, STORE_CODE &
REGION_CODE) are unique, the assigned values are non-repeating and there are no
nulls due to an effective use of foreign keys in each table to connect each entity. 
3. Do the tables exhibit referential integrity? Answer yes or no and then explain your
answer. Write NA (Not Applicable) if the table does not have a foreign key.
The table for employee exhibits referential integrity as each STORE_CODE value in
the table points to an existing STORE_CODE value in STORE. The same goes for the
store, having each REGION_CODE value in STORE pointing to an existing
REGION_CODE value in REGION, and each EMP_CODE value in STORE signifies to the
values that are already present in EMP_CODE value in EMPLOYEE. For the REGION it’s
NA as its table does not possess a foreign key. 
4. Describe the type(s) of relationships between STORE and REGION.

1.) Each REGION can contain multiple STORE 


2.) Each STORE is located in only one REGION 
o Many-to-one relationship (STORE & REGION) 

5. Create the ERD to show the relationship between STORE and REGION.

6. Create the relational diagram to show the relationship between STORE and REGION.

ASST. PROF. RONINA C. TAYUAN 5


DELGADO, ANDREI MANUEL L./ RIÑOZA, VINCENT KYLE T. 09/01/2020

7. Describe the type(s) of relationship(s) between EMPLOYEE and STORE. ( Hint: Each
store employs many employees, one of whom manages the store.)

1.) Each STORE can employ multiple EMPLOYEE  


2.) Each EMPLOYEE is employed by one STORE 
3.) A STORE is managed by one EMPLOYEE 
4.) An EMPLOYEE can only manage one STORE  
o One-to-many relationship (STORE & EMPLOYEE [regarding employment]) 
o One-to-one relationship (EMPLOYEE & STORE [regarding management])

8. Draw the ERD to show the relationships among EMPLOYEE, STORE, and REGION.

9. Create the relational diagram to show the relationships among EMPLOYEE, STORE,
and REGION.

ASST. PROF. RONINA C. TAYUAN 6


DELGADO, ANDREI MANUEL L./ RIÑOZA, VINCENT KYLE T. 09/01/2020

ASST. PROF. RONINA C. TAYUAN 7

You might also like