lOMoARcPSD|22701763 DBI202 LAB2 Dinhchinh - fdsdfsdfdsd database (Trường Đại học FPT) Studocu is not sponsored or endorsed by any college or university Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn) lOMoARcPSD|22701763 Name: Thái Đình Chinh Student ID: DE170147 Class: SE17C01 Subject: DBI202 Lab 2: FD Ex1: You have been given a form which shows the details of technical jobs carried out for different schools by members of staff in the local college. You will note that one job may require input from more than one member of staff. Each member of staff belongs to a department within the college and the number of hours worked on each job along with the date the job was undertaken are noted. A member of staff may work on more than one job on any given date. The college would like to set up a relational database to manage the allocation of staff to jobs and keep a more efficient record of the number of hours worked for each school within the college. Your task is making the database to 3NF (specify step by step: determine FDs, normalization,..). TechN o TechNa me DeptI d Departme nt JobN o Date SchoolI D School Hourswork ed 298 Walls, Ian 1 Engineerin g 1002 12/9/0 7 192 Beauty 2.5 298 Walls, Ian 1 Engineerin g 1003 12/9/0 7 125 Computi ng 5.5 345 Smith, Alan 2 Helpdesk 1002 12/9/0 7 192 Beauty 3 345 Smith, Alan 2 Helpdesk 3440 18/9/0 7 346 Bus & Man 1.5 345 Smith, Alan 2 Helpdesk 1480 15/9/0 7 192 Beauty 3 380 Jackson, Bob 3 Labs 3670 19/9/0 7 560 Design 4 380 Jackson, Bob 3 Labs 3440 18/9/0 7 346 Bus & Man 2 300 Jones, Joe 2 Helpdesk 1450 15/9/0 125 Computi 1 Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn) lOMoARcPSD|22701763 7 ng 300 Jones, Joe 2 Helpdesk 1480 15/9/0 7 192 Beauty 3 320 Young, Jill 3 Labs 3440 18/9/0 7 346 Bus & Man 4 320 Young, Jill 3 Labs 1002 12/9/0 7 192 Beauty 2.5 320 Young, Jill 3 Labs 3670 19/9/0 7 560 Design 2 EX1: - To normalize the given database to 3NF (Third Normal Form), we need to follow the steps of normalization: - Step 1: Identify the functional dependencies (FDs) From the given data, we can identify the following functional dependencies: TechNo => TechName, DeptId DeptId => Department JobNo, Date => Hoursworked SchoolID => School - Step 2: Create the initial table structure Based on the identified functional dependencies, we can create the initial table structure: Table 1: Staff TechNo TechName DeptId 298 Walls, Ian 1 345 Smith, Alan 2 380 Jackson, Bob 3 300 Jones, Joe 2 Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn) lOMoARcPSD|22701763 320 Young, Jill 3 Table 2: Departments DeptId Department 1 Engineering 2 Helpdesk 3 Labs Table 3: Jobs JobNo Date Hoursworked 1002 12/9/07 2.5 1003 12/9/07 5.5 3440 18/9/07 1.5 1480 15/9/07 3 3670 19/9/07 4 1450 15/9/07 1 Table 4: Schools SchoolID School 192 Beauty 125 Computing 346 Bus & Man 560 Design - Step 3: Apply the first normalization form (1NF) To achieve 1NF, we need to eliminate repeating groups and ensure that each column contains only atomic values. Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn) lOMoARcPSD|22701763 => The initial table structure already satisfies the requirements of 1NF. - Step 4: Apply the second normalization form (2NF) To achieve 2NF, we need to eliminate partial dependencies. Table 1: Staff TechNo TechName DeptId 298 Walls, Ian 1 345 Smith, Alan 2 380 Jackson, Bob 3 300 Jones, Joe 2 320 Young, Jill 3 Table 2: Departments DeptId Department 1 Engineering 2 Helpdesk 3 Labs Table 3: Jobs JobNo Date Hoursworked 1002 12/9/07 2.5 1003 12/9/07 5.5 3440 18/9/07 1.5 1480 15/9/07 3 3670 19/9/07 4 1450 15/9/07 1 Table 4: Schools Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn) lOMoARcPSD|22701763 SchoolID School 192 Beauty 125 Computing 346 Bus & Man 560 Design Table 5: StaffJobs TechNo JobNo 298 1002 298 1003 345 1002 345 3440 345 1480 380 3670 380 3440 300 1450 300 1480 320 3440 320 1002 320 3670 Table 6: JobSchools JobNo SchoolID 1002 192 Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn) lOMoARcPSD|22701763 1003 125 3440 346 1480 192 3670 560 1450 125 - Step 5: Apply the third normalization form (3NF) To achieve 3NF, we need to eliminate transitive dependencies. Table 1: Staff TechNo TechName 298 Walls, Ian 345 Smith, Alan 380 Jackson, Bob 300 Jones, Joe 320 Young, Jill Table 2: Departments DeptId Department 1 Engineering 2 Helpdesk 3 Labs Table 3: Jobs JobNo Date Hoursworked 1002 12/9/07 2.5 Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn) lOMoARcPSD|22701763 1003 12/9/07 5.5 3440 18/9/07 1.5 1480 15/9/07 3 3670 19/9/07 4 1450 15/9/07 1 Table 4: Schools SchoolID School 192 Beauty 125 Computing 346 Bus & Man 560 Design Table 5: StaffJobs TechNo JobNo 298 1002 298 1003 345 1002 345 3440 345 1480 380 3670 380 3440 300 1450 300 1480 320 3440 Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn) lOMoARcPSD|22701763 320 1002 320 3670 Table 6: JobSchools JobNo SchoolID 1002 192 1003 125 3440 346 1480 192 3670 560 1450 125 => The normalized tables are now in the 3NF. Each table contains non-redundant information, and there are no transitive dependencies or repeating groups. Downloaded by Tran Gia Hung (K17 HCM) (hungtgse170280@fpt.edu.vn)