0% found this document useful (0 votes)
112 views

Store - Code Region - Code & Emp - Code

The document describes relationships between tables in a sample database. It identifies primary keys and foreign keys for EMPLOYEE, STORE, and REGION tables. EMP_CODE is the primary key for EMPLOYEE. STORE_CODE is the primary key for STORE, which also has foreign keys REGION_CODE and EMP_CODE. REGION_CODE is the primary key for REGION. The tables exhibit entity and referential integrity. STORE and REGION have a one-to-one relationship. REGION has a one-to-many relationship with STORE. STORE has a one-to-many relationship with EMPLOYEE, while each EMPLOYEE has a one-to-one relationship

Uploaded by

Prabjyott Bajwa
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)
112 views

Store - Code Region - Code & Emp - Code

The document describes relationships between tables in a sample database. It identifies primary keys and foreign keys for EMPLOYEE, STORE, and REGION tables. EMP_CODE is the primary key for EMPLOYEE. STORE_CODE is the primary key for STORE, which also has foreign keys REGION_CODE and EMP_CODE. REGION_CODE is the primary key for REGION. The tables exhibit entity and referential integrity. STORE and REGION have a one-to-one relationship. REGION has a one-to-many relationship with STORE. STORE has a one-to-many relationship with EMPLOYEE, while each EMPLOYEE has a one-to-one relationship

Uploaded by

Prabjyott Bajwa
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/ 3

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.

Table PRIMARY KEY FOREIGN KEY


EMPLOYEE EMP_CODE STORE_CODE
STORE STORE_CODE REGION_CODE & EMP_CODE
REGION REGION_CODE NONE

2. Do the tables exhibit entity integrity? Answer yes or no and then explain your answer

TABLE ENTITY INTEGRITY EXPLANATION


EMPLOYEE YES Primary key- EMP_CODE of the
table is not null. Primary key all
the entries of the row is unique.
STORE YES Primary key- STORE_CODE of
the table is not null. Primary key
all the entries of the row is
unique.
REGION YES Primary key- REGION_CODE of
the table is not null. Primary key
all the entries of the row is
unique.

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.

TABLE REFERENTIAL INTEGRITY EXPLANATION


EMPLOYEE YES The foreign key STORE_CODE
1,2,3,4,5 of the EMPLOYEE table
exists in the primary key
STORE_CODE of the STORE
table
STORE YES The foreign keys,
REGION_CODE 1,2 &
EMP_CODE 8,12,7,3,15 of the
STORE table are present in
primary key EMP_CODE of
EMPLOYEE table and primary
key REGION_CODE of REGION
table
REGION NA(NOT APPLICABLE) NA(NOT APPLICABLE)

4. Describe the type(s) of relationship(s) between STORE and REGION (i.e. 1:1. I:N, or N:M), and explain
why.

Ans:-
TABLES RELATIONSHIP
STORE-TO-REGION 1:1
REGION-TO-STORE 1:M

EXPLANATION:

A) STORE-TO-REGION: As per tables, these tables are in one-to-one relationship (1:1), the reason being
one STORE having a STORE_CODE can be present only at one REGION at a time.

For examples: as per table, STORE_CODE:1 is just present in REGION_CODE:1, similarly same for all
values in the table.

B) REGION-TO-STORE: As per tables, these tables are in one-to-many relationship (1:M), the reason
being multiple stores are present in one REGION.

For examples: as per table, STORE_CODE:1 is present in REGION_CODE:1&2 as well, similarly same for
all values in the table.

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

Ans:-

TABLES RELATIONSHIP
STORE-TO-EMP 1:M
EMP-TO-STORE 1:1

EXPLANATION:

EMPLOYEE TO STORE: as per the table, one STORE having STORE_CODE:4 has six employees and
similarly STORE_CODE:3 is having six employees.

EMPLOYEE TO STORE: as per two tables EMPLOYEE and STORE, one employee works for only one store
at a time.

STORE TO EMPLOYEE: as per the two tables EMPLOYEE and STORE, one store can have multiple
employee working for it. Example: Store associated with STORE_CODE: 4 has 6 employees working for it.
6. Draw the database design to show the relationships among EMPLOYEE, STORE, and REGION, specify
the primary keys and foreign keys.

Ans:-

You might also like