Mid Term Examination I: Questions Marks Out of
Mid Term Examination I: Questions Marks Out of
1 10
2 15
3 5
Total 30
Instructions:
Heather Sweeney is an interior designer who specializes in home kitchen design. She offers variety of
seminars at home shows, kitchen and appliance stores, and other public locations. The seminars are
free; she offers them as a way of building her customer base. She earns revenue by selling books and
videos that instruct people on kitchen design. She also offers custom-design consulting services.
After someone attends a seminar, Heather wants to leave no stone unturned in attempting to sell that
person one of her products or services. She would therefore like to develop a database to keep track
of customers, the seminars they have attended, the contacts she has made with them, and the
purchases they have made. She wants to use this database to continue to contact her customers and
offer them products and services.
Figure below shows the seminar customer list form that Heather or her assistant fills out at seminars.
This includes basic data about seminar as well as name, phone, and email address of each seminar
attendee. Each of her seminar has at least more than 10 customers. This gives two Entities, one
SEMINAR and the other CUSTOMER.
The sales invoice that Heather uses to sell books and videos is shown in Figure below. SALES INVOICE
itself needs to be an entity, and because the sales invoice has customer data it has a relationship back
to CUSTOMER. (Note that we do not duplicate the customer data because we can obtain data items
via the relationship; if data items are missing, we add them to CUSTOMER).
Because Heather runs her computer with minimal security, she decided that she did not want to
record credit card numbers in her computer. Instead, she records only the PaymentType value in the
database and does not record the rest. Product details are stored in a separate entity PRODUCT with
a productid and is related to the INVOICE.
Based on the information above, please help Heather to construct an ER Diagram using the Crow’s
Foot notation. You can draw the ER diagram offline and paste a picture below.
Problem 2.
(a) Regional Labs is a company that conducts research and development work on a contract basis
for other companies and organizations.
Here ProjectID and EmployeeName form a composite primary key. Determine the Normal Form
of the table PROJECT. Show reasoning as to why a certain normal form is chosen. [2 Marks]
1NF:-foe being in 1NF, there should be non-multigroup and no repeating values in relation
record and that is difficult to determine by column name only as this relation show. But with
composite key(projectID and EmployeeName) it should possible to remove duplicacy in rows.
2. there will be no partial dependency( composites key must identify non-key column
rather than one key of composite key) :- In this relation, if EmployeeSalary is identified by
both Composite key( projectID and EmployeeName) then there should be 2NF form .
Example EmployeeName->EmployeeSalary
(b) Database transactions are governed by the ACID properties (Atomicity, Consistency, Isolation
& Durability). Consider the following Transactions applied on a Database table TestDB?
Suppose there are 2 rows X and Y. Also assume one of the rows of X has value 500 and one
of the rows of Y has value 100 (The values are provided just for reference).
Suppose transaction T has been executed till Read (Y) when T’’ starts. This results in an error.
From the ACID properties, find out which property this operation on T and T’’ violates and what
needs to be done to correct it. The example values of X and Y as mentioned above can be
used to solve this question. [5 Marks]
But in this example T run till READ Y then T’’ run. Here isolation properties violate that
serailaization of one transaction. It cause the error like Transaction T has x value
(500*100=50000) write it , read y . at the same time T” starts where it read the data of x=
50000 and y=100. But actualy end of T the y value is y(100-50)= 50. It make inconsistency
in database.
(c) Every weak entity set can be converted to a strong entity set by simply adding appropriate
attributes. Why, then, do we have weak entity sets? [3 Marks]
Weak entity is entity that has non independent. It dependent on strong entity for existence.
Two types of weak entity:- Id dependent and Non id dependent.
If there is wek entity that is no exit without its own existence like (no primary key)it has no
primary key then there is possibility to derived primary key of another table(strong entity)
but still it will be weak entity with id dependent for example
Room is weak entity has just roomno. Its existence depended on building entity and we can
identifies it attributes with adding new attribute from strong entity like building No+roomNo
two identifiers.
Describe and illustrate the process of normalizing the data shown in this table to third normal form
(3NF)? Basically, design the tables with its attributes and keys which will be formed because of the
table being converted to reach 3NF. Show the resulting tables below. You can use crows foot notation
if needed to display the tables. Displaying data is not mandatory. Proper display of the resulting #NF
normalised Table Schema is what is needed. [5 Marks]
This table is in 1Nf form , to bring it into 2,3 Nf , there si no primary key.
Step 1 determine functional dependency.
1Nf to 2Nf
Split the table
Table 1
vendor phoneNo
Table 2
Table1;-
Vendor(pk)-> phone no
Table2
Vendor,purchaseitem,purchasedate price
Vendor(fk)
Purchaseitem, purchadsedate,
key so there is no partial dependency because theres is only one primary key vendor nad
other composite keys a
Vendor phoneNo
staffNo and branchNo are the composite primary key pair of the table. Deduce the following:
a) Identify the Normal Form of the Table? Mention step by step reasoning. [2 Marks]
This relation is in its 1NF because there is no reapeating groups and no
multigroup values.
Step 2;- there are composite keys like staffNo and branchNo
Fd1=satffNo->name
staffNo name
branchNo branchaddress
b) Describe and illustrate the process of normalizing the data shown in this table to third
normal form (3NF)? Basically, design the tables with its attributes and keys which will be
formed because of the tables converted to achieve 3NF. Show the resulting tables below.
You can use crows foot notation if needed to display the tables. Displaying data is not
mandatory. Proper display of the resulting #NF normalised Table Schema is what is
needed. [3 Mark]
1Nf to 2NF:- This relation is in its 1NF because there is no reapeating groups
and no multigroup values.
To bring it into 2NF , split the table into three tables as follow
Table 1
Staff->name
Staff-(PK)
Table2
branchNo is PK
2NF to3NF
:- above realtion is in already in 3NF because all non prime attributes are
identified by composite keys there is no non-prime attribute mentioned by any
non prime attribute.
Fd1=satffNo(pk)->name
staffNo name
Staffno-Fk
branchNo branchaddress