180 likes | 198 Views
Practice of ER modeling. Yong Choi School of Business CSUB. Practice 1. A department hires many employees . A employee is hired by one department. A manager manages one department. A department is managed by one manager. Practice 2.
E N D
Practice of ER modeling Yong Choi School of Business CSUB
Practice 1 • A department hires many employees. A employee is hired by one department. • A manager manages one department. A department is managed by one manager.
Practice 2 • An author writes many books. A book is written by many authors. • A team consists of many players. A player plays for only one team.
Practice 3 • A lecturer teaches, at most, one course. A course is taught by exactly one lecturer. • A flight-hub connects two airports. An airport is used by many flight-hubs.
Practice 4 • A purchase order may be for many products. A product may appear on many purchase orders. • A customer may submit many orders. An order is for exactly one customer.
Practice 5 • A college has a large number of professors. Each professor may belong to one or several colleges in one university. In some cases, a professor may not belong to any college at all.
Practice 6 • The California State University has changed one of the policies about course schedule based upon feedback from professors and students. One of the changed policies is that a course may have one or more scheduled sections, or may not have a scheduled section at all. Each section has one course or may not have any course at all.
Practice 7 • According to the policy of the California Hospital, a patient must have a patient record. In other words, each patient may have one or more records.Each patient record must belong to exactly one patient.
Practice 8 • Since the growth rate of the California video store is very fast, the store has decided to change the inventory management policy. One of the policy is that a video store may stock more than one copy of a given movie and only one copy of a given movie can belong to one video store.
Practice 9 – Multiple Entities • A college runs many classes. Each class may be taught by several professors. A particular class may always use the same room. Because classes may held at different times or on different evenings, it is possible that each room can be used by many different classes. By the way, A professor can teach several classes.
Practice 10 – Multiple Entities • There are several departments in School of Business and Public Administration at CSUB (indication that cardinality from school to Dept is many). Each department belongs to one school. A department has many professors, but a professor may belong to more than one department. Similarly, courses may be offered by several departments and a department must have at least one course. A professor may teach more than one student, and a student may have more than one professor.
Practice 11 – Multiple Entities • Each employee in an engineering company has one recognized skill (e.g., mechanic, electrician), but a given skill may be possessed by several employees. An employee must be able to operate a given machine-type (e.g., milling machine, grinder). If any employee has one of several skills, each skill must be associated with the operation of only one machine type. Possession of a given skill (e.g., mechanic, electrician) allows an employee to maintain several machine-types. On the other hand, maintenance of any given machine-type requires a specific skill (e.g., a milling machine must be maintained by a mechanic).
Practice 12 – Recursive Relationship • In our company, we have several departments with more than 1000 employees. Each department is managed by one person, and must have a manager all the time by our corporate regulations. We would like to keep the following information on each department: department ID, department name, budget, and location. Each employee is supervised directly by one person, but each supervisor can manage many supervisees. As for employees, we would like to keep the following information: employee id, employee name, address, salary. Since data management of our company is becoming so complex, we plan to develop a database system to manage our current data requirements described here. • Develop business rules • Develop model using the case tool
Practice 13-1 • Read the following case study, which describes the data requirements for a video rental company: The video rental company has several branches throughout the USA. The data held on each branch is the branch address made up of street, city, state, and zip code, and the telephone number. Each branch is given a branch number, which is unique throughout the company. Each branch is allocated staff, which includes a Manager. The Manager is responsible for the day-today running of a given branch. The data held on a member of staff is his or her name, position, and salary.
Practice 13-2 • Each member of staff is given a staff number, which is unique throughout the company. Each branch has a stock of videos. The data held on a video is the catalog number, video number, title, category, daily rental, cost, status, and the names of the main actors, and the director. The catalog number uniquely identifies each video. However, in most cases, there are several copies of each video at a branch, and the individual copies are identified using the video number. A video is given a category such as Action, Adult, Children, Drama, Horror, or Sci-Fi. The status indicates whether a specific copy of a video is available for rent.
Practice 13-3 • Before hiring a video from the company, a customer must first register as a member of a local branch. The data held on a member is the first and last name, address, and the date that the member registered at a branch. Each member is given a member number, which is unique throughout all branches of the company. Once registered, a member is free to rent videos, up to maximum of ten at any one time. The data held on each video rented is the rental number, the full name and number of the member, the video number, title, and daily rental, and the dates the video is rented out and date returned. The rental number is unique throughout the company.
Real World Example 1-1 NCFCComp would like to keep track of their employees, departments and projects. The company is organized into departments. Each department has a unique name, a unique number and a particular employee who manages the department. We keep track of the start date when that employee began managing the department. A department may have several locations. A department controls a number of projects, each ofwhich has a unique name, a unique number and a single location. We need to store each employee's name, social security number, address, salary, sex, and birth date.
Real World Example 1-2 An employee is assigned to one department but maywork on several projects, which are not necessarilycontrolled by the same department. We need to keeptrack of the number of hours per week that anemployee works on each project. We also should keeptrack of the direct supervisor of each employee. Forinsurance purposes, we want to keep track of thedependents of each employee. We keep eachdependent's name, sex, birth date, and relationship toemployee. • Develop business rules • Develop data model using ERD