Computer Science Centre University of Indonesia Chapter 3 Data Modelling Using Entity-Relationship (ER) Model

Embed Size (px)

Citation preview

  • Slide 1

Computer Science Centre University of Indonesia Chapter 3 Data Modelling Using Entity-Relationship (ER) Model Slide 2 Phases of Database Design Slide 3 Company Example Database Application Description of the mini-world: The company is organized into departments. Each department has a unique name, a unique number and a particular employee who manages the department, including the date he/she began managing the department. A department may have several locations. Slide 4 Contd A department controls a number of projects Each project has a unique name, number and a single location Slide 5 Contd We record each employees name, SSN, address, salary, sex and birth date. Also we record who is the supervisor An employee works in one department but may work on several projects in different department We track work hours of employees in projects Slide 6 Contd We record the dependants of each employee, including the first name, sex, birth date and relationship to the employee Slide 7 ER Schema for Company Slide 8 Entity & Attributes Entity is the thing either physical existence (person, car, house) or conceptual (company, course, job). Attributes are the properties of the entity Each attributes has values. Slide 9 Entity, attribute & value example Slide 10 Composite vs. Simple Attributes Composite attributes can be divided into smaller part. For example, address consist of Street Address City State Postal Code Simple (atomic) attributes are no longer divisble Slide 11 Cond Slide 12 Single valued vs. Multi-valued Singe valued: Age Sex SSN Multi valued: Children Slide 13 Other terms Stored vs. derived values. Derived values example may include GPA, sub- totals, etc. Null values: nothing, not zero, not blank space! Slide 14 Complex attributes Composite and multi-valued attributes can be nested in an arbitrary way () for nesting {} for multi value Example {Address&Phone ( {Phone(AreaCode, PhoneNumber)}, Address(StreetAddress(Number, Street, ApartmentNumber), City, State, Zip) ) } 1850 b"> Value Sets Possible values of an attribute. Usually: Numeric Text Boolean Etc. But can be more specific, for example: Birth date must be > 1850 but before