5. Database DesignLingma AchesonDepartment of Computer and Information ScienceIUPUICSCI N207 Data Analysis Using Spreadsheets11What Design is AboutYou are hired by a small business, and are asked to build a database system. How would you proceed? There is no data to start with .Process:Collect requirementsInterview potential usersCollect sample forms, reports, description of activities Understand business rules and the nature of data2What Design is AboutDesign the databaseSketch out the designDocument the designEnvision the future systemCreate prototypes (small sample database)Get feedbacks from the usersImplement the database3Data NormalizationMust know before starting the design!Different levels of normalization determines how good your table design is.Relational model revisit:4
First Normal Form (1NF)E.g., Create tables to describe the students, advisors and registration information as below:
5StudentNoAdvisorAdvRoomClass1Class2Class31022Jones412101-07143-01159-024123Smith216201-01101-07214-01First Normal Form (1NF)First Normal Form: No repeating fieldsTable: REGISTRATION
6StudentNoAdvisorAdvRoomClassNo1022Jones412101-071022Jones412143-011022Jones412159-024123Smith216201-014123Smith216101-074123Smith216214-01Problem - If we change the room of Jones, we must change it in several places.Second Normal Form (2NF)Second Normal Form: Eliminate redundant data Table: REGISTRATIONTable: STUDENT_ADVISOR
7ClassNoStudentNo101-071022143-011022159-021022201-014123101-074123214-014123StudentNoAdvisorAdvRoom1022Jones4124123Smith216Problem - If we remove one advisor, we will lose a student.Third Normal Form (3NF)Third Normal Form: Eliminate data not dependant on keyTable: STUDENT Table: REGISTRATION
8ClassNoStudentNo101-071022143-011022159-021022201-014123101-074123214-014123StudentNoAdvisor1022Jones4123SmithAdvisorAdvRoomJones412Smith216Third Normal Form (3NF)Third Normal Form requires creation of primary key and foreign key relationships.Tables in a certain normalization level must satisfy the requirements of previous levels.
9Third Normal Form (3NF)Fully normalized tables:Table: STUDENT Table: REGISTRATION
10ClassIDStuID112131421252StuIDStudentNoAdvID110221241232AdvIDAdvisorAdvRoom1Jones4122Smith216ClassIDClassNoTitle1101-07Java Programming2143-01Databases3159-02Excel Spreadsheets4201-01Web Development5214-01Data MiningFourth & Fifth Normal FormFurther normalize the table, not covered in our class.