180 likes | 352 Views
Data Modelling : Modelling Object (Entity) classes, Attributes and relationships Data Modelling/ Object Structure analysis and design Logical Data Design Physical Database design Entity, Attributes, Instances: Customer Cust Name City Zip Phone # Cust #
E N D
Data Modelling: Modelling Object (Entity) classes, Attributes and relationships Data Modelling/ Object Structure analysis and design Logical Data Design Physical Database design Entity, Attributes, Instances: Customer Cust Name City Zip Phone # Cust # Unique Identifier: Cust# ( Primary Key)
Relationships between Object Classes/ Entities: How are instance relates to another (Business rules and Policies) Customer Sales Transactions Customer Sales Transactions initiates 0 to many Is initiated by 1 and only 1 Customer Sales Transaction Cardinality Min Max Min = 1 Existence Dependency
E/ R Model: Customer Sales Transaction Min Max Each Instance of class A is associated with one and only one instance of class B A B A B A B A B A B 1,35 A B
Recursive Relation • Course • Course ID • Subject • Course • Course Title • Course Credit Is a prerequisite for Has as a pre-requisite
Generalization/ Specialization SS# Name Address Person Dept Salary Teacher Students Major GPA • Inheritance • No Cardinality ( 1 to 1) Person Mutually Exclusive Teacher Students
Composition Relationship (HAS - A) An object instance is composed of one or more instances of another object class Sales Transaction ST Line
COURSE INSTRUCTOR CourseID Course Title Credit InstrID • Subject • Course # • Last Name • First Name SCHEDULED CLASS SchedClassID Day of Week Start Time End Time • CourseID • InstrID • RoomID ROOM RoomID Capacity • Bldg • Room# N-ary Relationships - Use an Association
Some Guidelines • Identifying Classes • each class has data it must remember • each class has at least one attribute • class has several attributes • all instances have same attribute ( & methods) • Assigning Attributes to Object classes • each attribute appears only once • assign attribute to object class that it most logically describes • Identifiers (Pks) for each class • sub-class assumes identifier of super-class
Sales Transaction Order # Order Date Xact. Type Sub Total Sales Tax Total Cash Sale Credit Order Order PickUp Amt Rcvd Pmt Type Pickup # Amt Charged App. Code
Q2: Flight Reservation Customer Flt # Dep Time Dep City Arr. Time Arr City Capacity Ticket # Dep Date Ticket Class Ticket Condition. Fare Cust Name Cust Address Cust Number
Deduction TS-Line Ded-Type Ded Amt Hrs-Worked Gross Pay Department Time Card Time Sheet Dept. Name Pay Period Ending Pay Period Ending TC-Line Date Time-In Time-Out Each TS-Line is related to only one time-card Time Card will have TC-Lines for employees on vacation Employee SSN Emp Name Tax Status Exempts Hourly Rate YTO-Gross Last Update