Presentation is loading. Please wait.

Presentation is loading. Please wait.

E-R Diagram (Cont.) Draw ER Diagram for the following scenario:

Similar presentations


Presentation on theme: "E-R Diagram (Cont.) Draw ER Diagram for the following scenario:"— Presentation transcript:

1 E-R Diagram (Cont.) Draw ER Diagram for the following scenario:
A video store rents movies to members. Each movie in the store has a title and is identified by a unique movie number. A movie can be in VHS, VCD, or DVD format. Each movie belongs to one of a given set of categories (action, adventure, comedy, ... ) The store has a name and a (unique) phone number for each member. Each member may provide a favorite movie category (used for marketing purposes).

2 There are two types of members:
1. Golden Members: Require their credit card and can rent more than one movie each time. 2. Bronze Members: Don't require their credit card and can rent only A member may have a number of dependents (with known names). Each dependent is allowed to rent one (1) movie at a time.

3 A video store rents movies to members.

4 Each movie in the store has a title and is identified by a unique movie number.

5 A movie can be in VHS, VCD, or DVD format.

6 The store has a name and (unique) phone number for each member.

7 Each movie belongs to one of a given set of categories (action, adventure, comedy, ... )

8

9

10

11

12

13

14

15

16

17 E-R Diagram for library management system

18 In the library Management system, the following entities and attributes can be identified.
Book -The set of all the books in the library. Each book has a Book-id, Title, Author, Price, and Available (y or n) as its attributes. Member-The set of all the library members. The member is described by the attributes Member_id, Name, Street, City, Zip_code, Mem_type, Mem_date (date of membership), Expiry_date. Publisher-the set of all the publishers of the books. Attributes of this entity are Pub_id, Name, Street, City, and Zip_code. Supplier-the set of all the Suppliers of the books. Attributes of this entity are Sup_id, Name, Street, City, and Zip_code. Assumptions: a publisher publishes a book. Supplier supplies book to library. Members borrow the book (only issue). Return of book is not taken into account

19

20 E-R Diagram for company Database

21 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 department manager. A department may have several locations. Each department controls a number of PROJECTs. Each project has a name, number, and is located at a single location. We store each EMPLOYEE's social security number, address, salary, sex, and birth date. 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 their name, sex, birth date, and relationship to the employee.

22

23 1. MANAGES: A 1:1 relationship type between EMPLOYEE and DEPARTMENT. Employee participation is partial. Department participation is total. The attribute StartDate is assigned to the relationship type. 2. WORKS_FOR: A 1:N relationship type between DEPARTMENT and EMPLOYEE. Both participations are total.

24 3. CONTROLS: 4. SUPERVISION:
A 1:N relationship type between DEPARTMENT & PROJECT. The participation of Project is total, whereas that of Department is partial. 4. SUPERVISION: A 1:N relationship type between EMPLOYEE (supervisor role) & EMPLOYEE (supervisee role). Both participations are partial.

25 5. WORKS_ON: 6. DEPENDENTS_OF:
An M:N relationship with attribute Hours. A project can have several employees working on it. Both participations are total. 6. DEPENDENTS_OF: A 1:N relationship type between EMPLOYEE & DEPENDENT. The participation of Employee is partial where as that of dependent is total.

26 E- R Diagram for Banking System: Case Study: Page No. 49

27

28 E-R Diagram for University database

29 The university keeps track of each student's name, student number, social security number, current address and phone number, permanent address and phone number, birthdate, sex, class (freshman, graduate), major department, minor department (if any), degree program (B.A., B.S., ... Ph.D.).  Some user applications need to refer to the city, state, and zip code of the student's permanent address and to the student's last name.  Both social security number and student number are unique for each student. All students will have at least a major department. Each department is described by a name, department code, office number, office phone, and college.  Both the name and code have unique values for each department. Each course has a course name, description, course number, number of credits, level and offering department.  The course number is unique for each course. Each section has an instructor, semester, year, course, and section number.  The section number distinguishes sections of the same course that are taught during the same semester/year; its value is an integer (1, 2, 3, ... up to the number of sections taught during each semester). A grade report must be generated for each student that lists the section, letter grade, and numeric grade (0,1,2,3, or 4) for each student and calculates his or her average GPA.

30 Department Student Course Section Degree Major In DName DCode
OfficeNumber OfficePhone College StudentID Name SSN Birth date Student Sex Minor In Class Address Offer City State Zip Grade_Report Course CName CourseDesc CNumber Credits Letter Grade Instructor Year GPA Belong_To Numeric Grade Section SectionNumber Semester

31 ER diagram for an AIRLINE database.

32 asterisks next to attribute names indicate primary key attribute(s)
asterisks next to attribute names indicate primary key attribute(s). plusses indicate foreign keys. AIRPORT(AirportCode*, Name, City, State) AIRPLANE_TYPE(TypeName*, Max-seats, Company) AIRPLANE(AirplaneId*, Total_no_of_seats, TypeName+) FLIGHT(Number*, Weekdays, Airline) FLIGHT_LEG(LegNo*, FLIGHTNumber*, DEPARTUREAIRPORTAirportCode+, ARRIVALAIRPORTAirportCode+, Scheduled_DepTime, Scheduled_ArrTime) LEG_INSTANCE(Date*, LegNo*, FLIGHTNumber*, No_of_avail_seats, DEPARTUREAIRPORTAirportCode+, ARRIVALAIRPORTAirportCode+, DepTime, ArrTime, AirplaneId+) FARE(Code*, FLIGHTNumber*, Amount, Restrictions) SEAT(SeatNo*, Date*, LEGLegNo*, FLIGHTNumber*, CustomerName, CPhone) CAN_LAND(AIRPORTAirportCode*, AIRPLANE_TYPETypeName*)

33


Download ppt "E-R Diagram (Cont.) Draw ER Diagram for the following scenario:"

Similar presentations


Ads by Google