Académique Documents
Professionnel Documents
Culture Documents
Database Management Systems Subject Code: ITC423 Assignment 1 Punith Kumar Sheshagirihalli Narasimhaiah Student Id: 11523674 Lecturer: Antoinette Cevenini Charles Sturt University
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674 Part A QA.1 Answer:
Staff table: Staff (Staff_id, Staff_fname, Staff_lname, Staff_employee_date, Nursery_id); Primary key (Staff_id) Foreign key Nursery_id References Nursery Alternate key (Staff_lname, Staff_employee_date) Nursery table: Nursery (Nursery_id, Nursery_code, Nursery_name, Nursery_address ) ; Primary key(Nursery_id) Alternate key (Nersery_code) QA.2
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674 Qualification table: Qualification (qual_id, contractor_id, qual_name) Primary key(qual_id) Foreign key contract_id References Contractor In the above table representation contract_id can also be used as a primary key but database designers prefer the uniquely identified primary key which does not have repetitions to avoid ambugity. Contractor table: Contractor (contractor_id, contractor_fname, contractor_lname ) Primary key (contractor_id) Employee table: Employee (contractor_id, skill_id, skill_description) Here two attributes are combining to form a primary key which is also called as composite key. Primary key (contractor_id, skill_id) Foreign key (contractor_id) References Contractor Foreign key (skill_id) References Skill
Skill table: Skill (skill_id, skill_acquired_date) Primary key (skill_id) QA.3 Answer:
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674
Contractor table: Contractor (contractor_id, contractor_fname, contractor_lname) Primary key (contractor_id) Project table: Project (staff_id, contractor_id, plan_id, contractor_work_start_date, contractor_work_end_date) In the above project table we have three foreign keys together forming a composite key which is used as a primary key in this case to know the contractor work start date and end date. Primary key (staff_id, contractor_id, plan_id) Plan table: Plan (plan_id, staff_id, plan_name) Primary key (plan_id) Foreign key (staff_id) References Staff Staff table: Staff (staff_id, staff_fname, staff_lname)
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674 Primary key (staff_id) PART B B.1 Answer: Dependency diagram: 1NF
Client_id
Client_name
Street
Town
Land size
Plan_id
Plan_name
Designer_name
Designer_location
Partial
Partial
Transitive
In 1NF(Client_id, Plan_id, client_name, Street, Town, Land size, Plan_name, Designer_name, Designer_location) in this table primary key is Client_id and Plan_id. In the above dependency diagram we have partial dependency and transitive dependencies. 1. Partial dependencies Client_id being a part of the primary key it can determine Client_name. Client_id >>> Client_name Plan_id is a part of a primary key which alone can determine value of some attributes. Plan_id >>> Plan_name, Land_size, Designer_name, Designer_location 2. Transitive dependencies Designer_name is a non-prime attribute which can determine the value of Designer_location exhibiting transitive dependency. Designer_name >>> Designer_location Student name: Punith kumar.SN Student id: 11523674
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674 B.2 Answer: In the given table nulls are eliminated and there are no repeating group and primary key Client_id and Plan_id uniquely identifies the attributes value therefore the given table is in 1NF form.
B.3 Answer: Since the given table is already in 1NF lets reduce it to 2NF first to get 3NF as shown below: To perform 2NF the table should already be in 1NF in this case it is satisfied because the given table is already in 1NF and there should not be any partial dependences. 2NF: Client table:
Client_id
Client_name
Plan table:
Plan_id
Plan_name
Land_size
Designer_name
Designer_location
City table:
Client_id
Plan_id
Street
Town
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674
3NF: To perform 3NF the table should be in 2NF we have a table in 2NF as shown above Client table: The transitive relationship should be eliminated in 3NF
Client_id
Client_name
Plan table:
Plan_id
Plan_name
Land_size
Designer_name
City table:
Client_id
Plan_id
Street
Town
Designer table:
Designer_name
Designer_location
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674 B.3 Answer: Client table: Client (Client_id, Client_name) Primary key (Client_id)
Plan table: Plan (Plan_id, Plan_name, Land_size, Designer_name) Primary key (Plan_id) Foreign key (Designer_name) References Designer
City table: City (Client_id, Plan_id, Street, Town) Primary key (Client_id, Plan_id)
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674 C.2 Answer: the EERD shown above is already has been reduced to simplest form and is in BCNF
10
C.3 Answer: 1.Nursery table: Nursery table( nursery_id, nursery_name, consultancy_id) Primary key(nursery_id) Foreign key (consultancy_id ) References Consultancy 2.Plant table: Plant ( plant_id, plant_name, plant_price) Primary key (plant_id) Foreign key (nursery_id) References Nursery Foreign key ( client_id) References Client Foreign key ( plan_id) References Plan 3.Client table: Client (client_id, client_name, consultancy_id) Primary key (client_id) Foreign key (consultancy_id) References Consultancy 4.Shrub table: Shrub(shrub_id, shrub_name, shrub_type, nursery_id, client_id, plan_id) Primary key(Shrub_id) Foreign key (nursery_id) References Nursery Student name: Punith kumar.SN Student id: 11523674
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674 Foreign key ( client_id) References Client Foreign key ( plan_id) References Plan 5.Designer table: Designer (designer_id, designer_name, designer_contact_num, land_size, land_structure, client_id, nursery_id) Primary key ( designer_id) Foreign key (client_id) References Client Foreign key (nursery_id) References Nursery Alternate key ( designer_contavt_num) 6.Consultancy table: Consultancy(consultancy_id, consultancy_name) Primary key (consultancy) 7.Plan table: Plan(plan_id, plan_name, plan_type, designer_id, client_id) Primary key (plan_id) Foreign key (designer_id) References Designer Foreign key (client_id) References Client 8.
11
DATABASE MANAGEMENT SYSTEMS Student name: Punith kumar.SN Student id: 11523674
12