120 likes | 344 Views
Figure 4-4a – Example of generalization. Notice anything?. All these types of vehicles have common attributes. So we put the shared attributes in a supertype. Note: no subtype for motorcycle, since it has no unique attributes. Figure 4-4b – Generalization to VEHICLE supertype.
E N D
Figure 4-4a – Example of generalization Notice anything? All these types of vehicles have common attributes
So we put the shared attributes in a supertype Note: no subtype for motorcycle, since it has no unique attributes Figure 4-4b – Generalization to VEHICLE supertype
Applies only to purchased parts Only applies to manufactured parts Figure 4-5a – Example of specialization
Figure 4-5b – Specialization to MANUFACTURED PART and PURCHASED PART Note: multivalued attribute was replaced by a relationship to another entity Created 2 subtypes
Figure 4-6b – Partial specialization rule A vehicle could be a car, a truck, or neither
Example COMPANY Database • Requirements of the Company (oversimplified for illustrative purposes) • The company is organized into DEPARTMENTs. Each department has a name, number and an employee who manages the department. We keep track of the start date of the departmentmanager. • Each department controls a number of PROJECTs. Each project has a name, number and islocated at a single location.
Example COMPANY Database (Cont.) • We store each EMPLOYEE’s social security number, address, salary, sex, and birthdate. Each employee works for one department but may work on several projects. We keep track of the number of hours per week that an employee currently works on each project. We also keep track of the direct supervisor of each employee. • Each employee may have a number of DEPENDENTs. For each dependent, we keep track of their name, sex, birthdate, and relationship to employee.
Academic Teaching Database Design an E-R schema for a database to store info about professors, courses and course sections indicating the following: • The name and employee ID number of each professor • The salary and email address(es) for each professor • How long each professor has been at the university • The course sections each professor teaches • The name, number and topic for each course offered • The section and room number for each course section • Each course section must have only one professor • Each course can have multiple sections
Visual View of the Database Employee ID Years Teaching Section ID Room Start Date N 1 Section Professor teaches Email N Salary First Part of Name Last 1 Number Course Topic Name
Example: University Database • Professors work for only one department • Departments have many professors • Each course is taught by only one professor • Students make a plan or program of study • A course could meet in several rooms/times • Graduate students must have an advisor • Cities are categorized as resident/BirthPlace • Visiting prof. need an End/Start date