Sample - Solved Diagrams DFD ERD Sementic Normalization Etc
Sample - Solved Diagrams DFD ERD Sementic Normalization Etc
Sample - Solved Diagrams DFD ERD Sementic Normalization Etc
Government/Private Sector
Tender
Bid
Selection of
Company
Accepted
Rejected
If rejected then
select another
company
Contract
Inspection
Process
Rejected
Work Permit
Payment
Supplier
Hire
Workers
Allocation
of
Employees
Supply
Material
Labor
Employee
Payment if
approved
Partial
payment
(Phase to
phase)
Project in
progress
Project Completed
Quality
Testing
Compensate
Court Notification
Contract
Tender
Supplier
Employee
Contract
Management
System
Labor
Payment
Tender
Project
Completed
Selecting
Company
Quality
Testing
Contract
Payment
Material
Machinery
Inspection
Process
Process
in
progress
Work Permit
Allocation
Of
Employees
Charges Payment
Tender
has
For simplicity, I
put the contract
here.
Contracts needs
Measurement
criteria
requires
Material
details
requires
Machinery
details
Employee
allocation
has
Material
has
Contract
has
Machinery supplies
supplies
Job
type
Is associated
Designation
with
Supplier
Tender
Is filled
with
Bid
Is filled
for
charges
M Payment
allocates
M Employee
allocates
1
Contract
1
Supplier 1
supplies
Material
requires
1
supplies
Machinery
requires
Labor
charges
Payment
1
Tender
has
Contract
needs
Employee
allocation
supplies
has
M Material 1
has
1
Measurement
criteria
Job type
1
has
supplies
1 Employee
1
has
Supplier 1
requires
M Machinery 1
has
Material
detail
Is
associated
with
M
Machinery
detail
Designation
Tender
(Tender_Ref_Num, Cost_of_Tender, Anticiapted_Cost, Opening_Date)
Contract
(Contract_ID, Tender_Ref_Num, Status, Bid_Amount, Location)
Payment
(Contract_ID, Date, Amount_Paid)
Supplier
(Supplier_ID, Supplier_Name)
Employee
(Employee_ID, Employee_Name, Designation, Salary, No_of_Days, Address, Date_of_birth,
Job_Type, Joining_Date, Contract_ID)
Material
(Material_ID, Material_Name, Cost, Quantity, Measurement_Criteria, Supplier_ID,
Contract_ID)
Machinery
(Machine_ID, Machine_Name, Rent_Rate, Hiring_date, Returning_Date, Comission_Date,
Purchasing_Date, Supplier_ID, Contract_ID)
We can have more than one Contract ID for a single employee. Similarly we can have more than one
employee for a single Contract. So these two attributes will become multi-valued and as we have more
than one Contract IDs for an employee, then its logical that there will be different salaries for an
employee because of more than one Contracts (an employee can take different salaries with respect to
the number and type of Contracts).In the same way, an Employee can have more than one designations
depending upon the contract. Similarly, Job Type Allocation Date and No. of days will also become
multivalued due to the multivalued ContractID.
Material /Machinery:
We have multi valued attributes in the material and machinery Entities. A material/machine can be
bought from more than one supplier and for more than one contract. As the requirements will be
different for different contracts, so there will be different quantities of material for each contract. So the
whole setup will make these attributes multi valued.
Employee_ID (PK)
Employee_Name
Address
Date_of_birth
Joining_Date
Employee Allocation:
Employee_ID (FK)
Contract_ID (FK)
Salary
Allocation_Date
No_of_Day
Designation
Job_Type
Composite Key: (Employee_ID, Contract_ID)
So now every attribute will be single valued at one instance in each entity.
MATERIAL:
(Material_ID, Material_Name, Cost, Quantity, Measurement_Criteria, Supplier_ID, Contract_ID)
Since Contract ID and Supplier ID are multivalued attributes so we'll maintain them in another entity
namely Material Detail.
Material:
Material_ID (PK)
Material_Name
Measurement_Criteria
Material Detail:
Material_ID (FK)
Cost
Quantity
Supplier_ID (FK)
Contract_ID (FK)
Composite Key: (Material_ID, Supplier_ID, Contract_ID)
MACHINERY:
(Machine_ID, Machine_Name, Rent_Rate, Hiring_date, Returning_Date, Comission_Date,
Purchasing_Date, Supplier_ID, Contract_ID)
Making a weak entity (Machine Detail) for the multivalued attributes:
Machinery:
Machine_ID (PK)
Machine_Name
Rent_Rate
Hiring_date
Returning_Date
Comission_Date
Purchasing_date
Machinery Detail:
Machine_ID (FK)
Supplier_ID (FK)
Contract_ID (FK)
Composite Key: (Machine_ID, Supplier_ID, Contract_ID)
So now Contract_ID and Supplier_ID are single valued at each instance in the Material / Machinery
Detail entity.
Machine Detail:
Composite Key: (Machine_ID, Supplier_ID, Contract_ID)
It is a weak entity set and there is no non key attribute in this entity. It holds for 2NF.
Transitive Dependency:
A transitive dependency occurs when one non key attribute determines another non key attribute. For
third normal form we concentrate on relations with only one candidate key, and we eliminate transitive
dependencies.
Employee Allocation
Material
Employee_Allocation:
Attributes of "Employee Allocation" are:
Employee_ID (FK)
Contract_ID (FK)
Salary
Allocation_Date
No_of_Day
Designation
Job_Type
Here the Composite Key is " Employee_ID and Contract_ID", which determines all the remaining
attributes, but the problem is that here is another attribute which is a non key attribute namely
Designation which also determines other non key attributes that is Job_type, which involves the
Transitive dependency and due to this dependency anomalies can occur in the project, so it must be
resolved.
In order to resolve this Transitive dependency, we need to add another table namely "Designation",
having the following attributes:
Designation:
Designation_ID
Designation_Name
Here Designation_ID is the primary key, which determines the non key attribute Designation_Name.
Since Job_Type field is dependent upon both Designation and Employee so we can't place it in the
Employee Allocation table, neither can we add it in the Designation table. So a weak entity set is created
for compensating the Job_Type attribute namely:
Job_Type
Employee_ID
Designation_ID
Job_Type
Composite Key: (Employee_ID, Designation _ID)
From the Employee relation we have got the following new relations:
Employee:
Employee_ID (PK)
Employee_Name
Address
Date_of_birth
Joining_Date
Employee Allocation:
Employee_ID (FK)
Contract_ID (FK)
Salary
Allocation_Date
No_of_Day
Composite Key: (Employee_ID, Contract_ID)
Designation:
Designation_ID (PK)
Designation_Name
Job_Type
Employee_ID
Designation_ID
Job_Type
Composite Key: (Employee_ID, Designation _ID)
MATERIAL:
Again the problem is also same with this table, it also holds Transitive dependency, this relation contains
following attributes:
Material_ID
Material_Name
Measurement_Criteria
Here the Primary Key is "Material_ID" which determines the remaining two attributes, but the problem
is that "Material_Name" which is a non key attribute also determines another non key attribute that is
"Measurement_Criteria", so it also has Transitive dependency.
We resolve this problem by breaking the table of "Material" into two tables, these two tables and their
corresponding attributes are given below:
Material:
Material_ID (PK)
Material_Name
Material_ID (PK)
Measurement_Criteria
Now we have total three tables related to the Material altogether, and these are:
Material
Measurement_Criteria
Material_Detail
We have defined the fields of first two tables above but the attributes of the "Matrial_Detail" table are:
Material_Detail:
Material_ID (FK)
Contract_ID (FK)
Supplier_ID (FK)
Date
Quantity
Cost
Composite key: Material_ID, Contract_ID, Supplier_ID and Date
Remaining tables remains the same because they don't have Transitive dependency, so they are in 3rd
normal form (3NF).
DEFINITION:
A relation is in fourth normal form if and only if it is in Boyce-Codd normal form and there are no non
trivial multivalued dependencies.
Multivalued Dependencies:
Let R be a relation having attributes or sets A, B and C. There is a multivalued dependence of attribute B
on attribute A if and only if the set of B values associated with a given A values are independent of the C
values.
The dependency A
all of R.
All the tables involving in this project are in fourth normal form (4NF), because there is not any table
which contains any multivalued attribute.
A
Y
Y
N
Y
B
Y
N
N
N
C
Y
N
N
N
D
Y
N
N
N
E
Y
N
N
N
F
N
Y
N
N
G
N
Y
N
N
H
N
Y
N
N
D
Y
Y
N
N
E
Y
Y
N
N
F
N
Y
N
N
G
N
Y
N
N
H
N
Y
N
N
J
N
N
Y
Y
K
N
N
Y
N
L
N
N
N
Y
J
N
N
Y
Y
K
N
N
Y
Y
L
N
N
N
Y
N
Y
N
N
B
Y
Y
N
N
C
Y
Y
N
N
N
Y
N
N
Since not a single row yields to complete Ys so it shows that it is not in 5NF.Again considering all the
relations and their FDs:
Reconsidering Job_Type Relation:
Employee_ID
Designation_ID
Job_Type
FD: Employee_ID, Designation_ID Job_Type
Adding the Contract_ID in the Composite key of Job Type, the attributes will be:
Employee_ID
Designation_ID
Contract_ID
Job_Type
FD: Contract_ID, Employee_ID, Designation_ID Job_Type
The above entity holds for 1NF, 2NF, 3NF, 4NF and BCNF as well.
Checking The Relation For 5NF.
R(A,B,C,D,E,F,G,H,I,J,K,L)
Decomposition: R1(A,B,C,D,E), R2 (A,F,G,H,I), R3 (J,K), R4(A,F,J,L)
FDs: A BCDE, AF GHI, J K, AFJ L
Initial Placement of values:
R1(A,B,C,D,E)
R2(A,F,G,H,I)
R3(J,K)
R4(A,F,J,L)
A
Y
Y
N
Y
B
Y
N
N
N
C
Y
N
N
N
D
Y
N
N
N
E
Y
N
N
N
F
N
Y
N
Y
G
N
Y
N
N
H
N
Y
N
N
J
N
N
Y
Y
N
Y
N
N
K
N
N
Y
N
B
Y
N
N
C
Y
N
N
D
Y
N
N
E
Y
N
N
F
N
Y
N
G
N
Y
N
H
N
Y
N
I
N
Y
N
J
N
N
Y
K
N
N
Y
L
N
N
N
L
N
N
N
Y
B
Y
N
N
C
N
N
Y
D
N
Y
N
E
N
Y
N
F
N
Y
N
G
N
Y
N
H
N
Y
N
B
Y
C
N
D
N
E
N
F
N
G
N
H
N
Machine_ID = A
Machine_Name = B
Rent_Rate = C
Hiring_date = D
Returning_Date = E
Comission_Date = F
Purchasing_date = G
Supplier_ID = H
Contract_ID = I
R(A,B,C,D,E,F,G,H,I)
Decomposition: R1 (A,B,C,D,E,F,G), R2 (A,H,I)
FDs: A BCDEFG
Initial Placement of values:
A
R1(A,B,C,D,E,F,G) Y
R2(A,H,I)
Y
B
Y
N
C
Y
N
D
Y
N
E
Y
N
F
Y
N
G
Y
N
H
N
Y
I
N
Y
B
Y
C
Y
D
Y
E
Y
F
Y
G
Y
H
N
I
N
Tender
(Tender_Reference_Number, Cost_of_Tender, Anticiapted_Cost, Opening_Date)
Contract
(Contract_ID, Tender_Reference_Number, Status, Bid_Amount, Location)
Payment
(Contract_ID, Date, Amount_Paid)
Supplier
(Supplier_ID, Supplier_Name)
Employee
(Employee_ID, Employee_Name, Address, Date_of_birth, Joining_Date,)
Employee Allocation
(Employee_ID, Contract_ID, Salary, Allocation_Date, No_of_Day)
Designation
(Designation_ID, Designation_Name)
Job_Type
(Employee_ID, Designation_ID, Job_Type)
Material
(Material_ID, Material_Name)
Measurement_Criteria
(Material_ID, Measurement_Criteria)
Material_Detail
(Material_ID, Contract_ID, Supplier_ID, Date, Quantity, Cost)
Machinery
(Machine_ID, Machine_Name, Rent_Rate, Hiring_date, Returning_Date, Comission_Date,
Purchasing_Date,)
Machinery Detail:
(Machine_ID, Supplier_ID, Contract_ID)
DATA DICTIONARY
Table # 1: Tender
Tender_Ref_Num (nvarchar)
Cost_Of_Tender (money)
Anticipated_Cost (money)
Opening_Date (datetime)
Table # 2: Contract
Contract_ID (int)
Tender_Ref_Num (nvarchar)
Status (char)
Bid (int)
Location (nvarchar)
Table # 3: Payment
Contract_ID (int)
Date (datetime)
Amount_Paid (money)
Table # 4: Supplier
Supplier_ID (int)
Supplier_Name (nvarchar)
Table # 5: Employee
Employee_ID (int)
Employee_Name (nvarchar)
Address (nvarchar)
Date_of_birth (datetime)
Joining_Date (datetime)
Table # 7:Designation
Designation_ID (int)
Designation_Name (nvarchar)
Table # 8:Job_Type
Employee_ID (int)
Contract_ID (int)
Designation_ID (int)
Job_Type (nvarchar)
Table # 9: Material
Material_ID (int)
Material_Name (nvarchar)
Machine_ID (int)
Machine_Name (nvarchar)
Rent_Rate (money)
Hiring_Date (datetime)
Returning_Date (datetime)
Comission_Date (datetime)
Purchasing_Date (datetime)
"RELATIONAL SCHEMA"
Openeing_Date)
|
| Normalization |
|
|
Semantic |
|
Front End
|
|
Net
|
|
Forms/Projects
|
|
|
|
|
|
|
|
|
|
|
|
|
|________________|______________|______________________________|
PS: Enjoy Summer Vacations!
Peace!