Matakuliah : Web Database Tahun : 2008 Database Design Session 4 and 5 Last Session Review: •Web Basic Concept •How to put information on Web •Dynamic Web pages •New Development of Web 2 Agenda: •Conventional Database Design Method •Requirements Analysis •Data Analysis •Data Design •Physical Database Design 3 Objectives: •Student understand Conventional Database Design Method •Student can do Requirements Analysis, Data Analysis, Data Design and Physical Database Design •Student can design conceptual data model and ERD 4 Conventional Database Design Method • What is Database Design? – Process of creating a design for a database that will support the enterprise’s operations and objectives • Major Aims for Database Design? – Represent data and relationship between data required by all major application area and user’s groups – Provide data model that support any transactions required on the data – Specify a minimum design that is appropriately structured to achieve stated performance requirements for the system • Two main approaches in Database Design? – Entity Relationship Diagram (ERD), for Relational Database – UML, for Object Data Modeling 5 Conventional Database Design Method (cont.) 6 Conventional Database Design Method (cont.) • Steps in Database Design Method? – – – – Requirements Analysis Data Analysis Data Design Physical Database Design • Input in Database Design Method? – The Organization: serve as sponsor of new system • Output in Database Design Method? – – – – Description of the Organization and System Requirements Conceptual Data Model Logical Data Model Physical Data Model 7 Requirements Analysis • What is Requirements Analysis? – The process of collecting and analyzing information about the part of the organization that is to be supported by the database system, and using this information to identify the requirement for the new system • Technique to do Requirement Analysis? – – – – – Observation Interview Inspecting Documents Surveying Experts Using Other Information • Output from Requirements Analysis? – Description of the organization and system requirements 8 Requirements Analysis (cont.) • Study Case Requirements Analysis Assume that you are developing a database system for your enterprise, whether it is a university (or college) or business (or department). Consider what technique you would use to identify the important facts needed to develop a database system. 9 Data Analysis • What is Data Analysis? – The process of describing the organization in terms of the phenomena that must be represented within the database. • How to do Data Analysis? There are 2 approach: – Top-Down – Bottom-Up • Output from Data Analysis? – Conceptual Data Model 10 Data Analysis (cont.) • 3 Component in Database: – Entity • should be unique and has name. Represent objects or things in real world that has independent existence. • Example: Student Entity • Representation: Or x – Relationship • connection between one entity with another. • Example: Relationship between student entity and faculty entity • Representation: Or 11 Data Analysis (cont.) • 3 Component in Database: – Attribute • Fact-fact that describe entity or relationship • Example: Nim and Name attribute in Entity • Representation: Or 12 Data Analysis (cont.) • 2 Approach of Data Analysis that are commonly used? – Top-Down • Top-down=entity-relationship-attribute data analysis • How: – Identify entities: usually represent the real world – Identify relationships between entities: identify direct relationship only – Identify entities attributes: fact about entities that must represent in database • Advantages: – Represent real world – Filter out entities, relationships and attributes that do not make sense or not useful within the context of problem – Appropriate for complex database with many attributes • Disadvantages: – Often result in a simpler conceptual model 13 Data Analysis (cont.) • 2 Approach of Data Analysis that are commonly used? – Top-Down • Example: – University has students and faculty. – Create Students and Faculty entity. – Students and Faculty has direct relationship, which is: Students choose Faculty. “Choose” is relationship. – Students has nim, name, address, place of birth and date of birth, while Faculty has faculty code, faculty name and dean. Those are the attributes. 14 Data Analysis (cont.) • 2 Approach of Data Analysis that are commonly used? – Bottom-Up • Bottom-Up=attribute-relationship-entity data analysis • Based on the notion that entities are implicit in the data values • How: – Identify data item (attribute): identified from fields on data recording form or contents of organizations files and records – Identify relationships between data items: identify connection between one data item with the others – Identify entities: deducted from the attributes and relationships identified in step 1 and 2 • Advantages: – Appropriate for simple database design – Give attention on detail attributes • Disadvantages: – Hard to use in complex database design 15 Data Analysis (cont.) • 2 Approach of Data Analysis that are commonly used? – Bottom-Up • Example: – University has student data form. – In that form, there are several field that can be filled. Those fields are: nim, name, address, place of birth, date of birth, faculty code, faculty name and dean. Those are the attributes. – Find relationship between those data items. Nim, name, address, place of birth and date of birth are describing one entity and faculty code, name and dean are describing one entity. – Separate those attributes and relationships into entities Students and Faculty entities. 16 Data Analysis (cont.) • 2 Approach of Data Analysis that are commonly used? – Those 2 approach can be combine, depend on the situations and needs. – Other Approach: • Inside-Out: related to the bottom-up approach but differ by the first identifying a set of major entities and then spreading out to consider other entities, relationships and attributes associated with those first identified 17 Data Analysis (cont.) • Type of Relationships between entities? – One-to-one – One-to-many – Many-to-many – Zero-or-one-to-many – Model composite key and generalization/specification 18 Data Analysis (cont.) • Case Study for Data Analysis Consider the following statement and use both top-down and bottom-up technique: Students attending Honley University enroll on courses. There are prerequisites for enrollment, i.e. the student must have certain qualifications, or be accepted by Dr. Brown the admissions tutor. The institute currently has 3000 students enrolled. Once enrolled, the student will accumulate credits by taking various course modules, such as Programming and Object Database. A grade is awarded for each completed modules. The grade will be A, B, C, D or E. A represents distinction, and E a fail. Students may be full time or part time. 19 Data Design • What is a Data Design? – The process of defining a logical data model that implements the conceptual model as a database • Input Data Design? – Conceptual data model • How to do Data Design? – Transform conceptual data model into a relational database by applying several rules – Normalization • Output from Data Design? – ERD Normal 20 Data Design (cont.) • Rules to transform? – Representation of Entities • Each entity in the Conceptual data model becomes a table. Each property become attribute. A primary key is selected – One-to-one • Transform into 1 table – One-to-many • Transform into 2 tables • Primary key in “one” (parent or owner) table migrates to “many” (child or member) table (become foreign key). Each row in many table “many” cross-reference a row in the “one” table. – Many-to-many • Replaced by two one-to-many relationships – Zero-or-one-to-many • Represented by a separate table, in the same way that one-to-many relationships are 21 Data Design (cont.) • Normalization? – First Normal Form (1NF): • • • • simplifying the structure in a database Ensure each data value represent a single fact Select Primary Key Eliminate redundancy and calculation – Second Normal Form (2NF): • Eliminate partial dependency – Third Normal Form (3NF): • Eliminate transitive dependency 22 Data Design (cont.) • Case Study 1 for Data Design? Represent the following structure as ERD model: “The university of Honley is a technical university, with five faculties, each with departments” 23 Data Design (cont.) • Case Study 2 for Data Design? A relational table is designed to represent details of projects. Its columns are project number, employee number of project leader, project name, host department and head of host department. Each project has a unique number, a leader and a host department. Each department has only one head, but can host many projects. Make the 3NF from this case. 24 Physical Database Design • What is a Physical Database Design? – The phase in design process wherein the designer decides how the database is to be stored in DBMS. Highly connected with DBMS. • Will be discuss in details in Session 8 25 Summary • Requirements Analysis: process to collect and analyze needs from the organization • Data Analysis: derives a conceptual model of the database. Most commonly used technique: top-down and bottom-up. • Data Design: derives a ERD Normal. • Physical Database Design: highly connected with DBMS. 26 Next Session: •Complication in Web Database •Limitation in Web Database Method •Web Database Design Method •Web Data Analysis •Logical Web Data Design •Physical Web Database Design •Review session 1-7 27 End of Database Design Thank you 28