Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 Database System Design (part II)

Similar presentations


Presentation on theme: "Chapter 2 Database System Design (part II)"— Presentation transcript:

1 Chapter 2 Database System Design (part II)
University of Manitoba Asper School of Business 3500 DBMS Bob Travica Chapter 2 Database System Design (part II) Based on G. Post, DBMS: Designing & Building Business Applications Updated 2015 1

2 Special Associations: Aggregation
Sale Item * contains * SaleID SaleDate EmployeeID ItemID Description listPrice Many-to-many relationship: Each sale transaction contains many items, and each item can be included in many sale transactions (provided items are keyed generically - ItemID identifies a sort of things). Item and Sale are loosely coupled. SaleID is the unique key (identifies one specific sale transaction), ItemA ItemB Note: This is called instance diagram and it might help you with visualizing multiplicity. Sale1 Sale2 ItemC

3 Special Associations: Composition (Part-Whole Relationship)
Two ways of displaying composition: Wheel WheelID Rim Spoke 2 part of Crank CrankID Weight Stem StemID Size Bicycle BicycleID Model Type 1 A Bicycle Size Model Type Wheel Crank Stem B Association between the whole class (Bicycle) and part classes (Wheel, Crank and Stem). The whole class is composed from part classes—it does not exist without certain parts. Parts have purpose as the parts of a specific whole—they live and die with the whole. Therefore, part classes and whole class are tightly coupled. Typical use: Manufacturing, bill-of-materials

4 Generalization Animal AnimalID DateBorn Name Gender ListPrice Mammal
LiiterSize TailLength Fish FreshWater ScaleCondition Spider Venomous Habitat {disjoint} is_a Is_a Association between the Superclass (Animal) and Sub-Classes (Mammal, Fish, Spider). Example: Modeling data on animals sold in a pet store. Superclass is parent class, and sub-class is the child class that inherits from parent. Generalization/Specialization resembles hierarchical classification schemes. Multiplicity is assumed: 1:1

5 Inheritance Concept from Object Orientated Approach
Account AccountID CustomerID DateOpened CurrentBalance OpenAccount CloseAccount Class name Attributes Methods Class Encapsulation of Data Attributes Methods (Behavior) Inheritance Properties: Parent class (Super-class) and Sub-classes – inheriting attributes & methods Unique attributes and methods in sub-classes (all listed) Polymorphism (variation of parent’s methods in children) SavingsAccount InterestRate PayInterest CheckingAccount MinimumBalance Overdraft BillOverdraftFees CloseAccount Polymorphism

6 Class Diagram of Pet Store System
Each animal keyed uniquely. Animal Customer Supplier Merchandise PurchaseOrder Sale Employee * 1 SaleItem MerchOrderItem Merchandise keyed generically. Note – differences from the textbook: Names of some classes modified. Association names not included. Some other slight modifications.

7 Pet Store Normalized Tables Diagram (Schema)

8 Data Types (Domains) Format of data and range of values. Access
SQL Server Oracle Text fixed variable memo Memo char, nchar varchar, nvarchar text, ntext CHAR VARCHAR2,NVARCHAR2 LONG Number Byte (8 bits) Integer (16 bits) Long (32 bits) (64 bits) Fixed precision Float Double Cur rency Yes/No Byte Integer Long NA Currency tinyint smallint int bigint decimal(p,s) real float money bit INTEGER NUMBER(127,0) NUMBER(p,s) NUMBER, FLOAT NUMBER NUMBER(38,4) Date/Time datetime s malldatetime DATE Image OLE Object image LONG RAW, BLOB AutoNumber Identity rowguidcol SEQUENCES ROWID Common Type

9 {Age = Today’s Date - DateOfBirth}
Computed Attributes Denote computed values. Written with a slash (/). Employee Name DateOfBirth /Age Phone {Age = Today’s Date - DateOfBirth} Common example in business DB system: Sum=Item’s Sale Price * Quantity Sold

10 Events & Triggers+ + Discussion in the book somewhat confusing.
Generate Standing Purchasing Order. Scroll down slides file. Change in time: ON (LastDayInMonth) Change in user interface: OnClickOfMouse Notify Purchasing Manager. Change in data: ON (QuantityOnHand < 100) Decrease Inventory count. Change in organization : Item is sold. Code (program) invoked by events.* Definition: Some change in organization, data, time, user interface invoking execution of certain code (programs). TRIGGER EVENT *In the general information systems vocabulary, triggers would make application software (application). But in the database systems vocabulary, “application” is usually used for designating a forms and reports working with a particular database. + Discussion in the book somewhat confusing.

11 Rolling Thunder Bicycles: Package View
Sales Assembly Purchasing Location Bicycle Employee Package = A grouping of related elements to provide an overview of a database system. Each package typically has more classes. The way modern OO systems are designed and procured.

12 Rolling Thunder Bicycles: Sales Package
Customer CustomerID Phone FirstName LastName Address ZipCode CityID BalanceDue Transaction TransactionDate EmployeeID Amount Description Reference Retail Store StoreID StoreName ContactFirstName ContactLastName Bicycle::Bicycle BicycleID 1..1 0..* 0..1 From Bicycle package


Download ppt "Chapter 2 Database System Design (part II)"

Similar presentations


Ads by Google