Copyright © 2003 Addison-Wesley Your name here
Copyright © 2003 Addison-Wesley Representing Information with Data Models What is a data model? How does a system designer discover and specify information requirements How is information organized so that it can be easily, accurately and efficiently managed by a database system? What are relationships and how are they discovered and specified? What information must be part of the BigHit Online information system?
Copyright © 2003 Addison-Wesley What is a Data Model? A data model is a precise description of information content Types of data models –Conceptual: in terms that users will understand –Logical: in terms that a relational database system will understand –Physical: in terms of the underlying computer hardware and operating system Database schemas –Schema is another word for model that implies that it adheres to a particular strategy for defining modelsc
Copyright © 2003 Addison-Wesley Database Schemas A Schema is a data model that is intended to be used with a database system –External schemas are defined for the users of a database –Logical schema defines the representation as a collection of tables that are stored in a database server –Internal schema defines the representation used by the database server to store the tables in memory or files
Copyright © 2003 Addison-Wesley Organizing Information To understand data modeling we must learn many new technical terms Entity –A thing (object) that is of interest to an information system –An abstraction of the object that contains those characteristics that are important to the information system Entity class –The common characteristics that represent a set of entities –The common characteristics of a particular set of entities that make them distinct from other entities Attribute value –A characteristic of an entity –The value of a particular characteristic Attribute –A characteristic that helps to describe an object Examples –Entity: A customer, or the characteristics of a customer that are of interest –Entity class: All of the potential customers, or the information about them –Attribute: hair color or last name –Attribute value: hair color is brown or last name is ‘Breaux’
Copyright © 2003 Addison-Wesley Sample BigHit Entity Classes Entity ClassDescription Customer A customer of the business Video An item in the rental inventory Employee A person who works in one or more stores PayStatement A record of the wages paid to an employee TimeCard A record of a block of time worked by an employee at a store Store One of the retail outlets of BigHit Video Rental The rental of a video by a customer for a specific period and cost PurchaseOrder A request to purchase an item Supplier A company that sells items to BigHit Video
Copyright © 2003 Addison-Wesley Sample BigHit Attributes AttributeTypeRestrictions on Values DescriptionSample Value title StringUnboundedThe title of an itemAnnie Hall lastName String30 charactersThe last name of a person Block firstName String30 charactersThe first name of a person Jane String50 charactersThe address of a person rating String‘G’, ‘PG’, ‘PG-13’, ‘R’, ‘NC-17’ ‘NR’ The rating of a moviePG-13 ssn String9 digits (0–9)A Social Security number accountId Number4 byte integerThe identifier of a customer account 101 otherUsers SetSet of strings of 30 characters Names of other people authorized to use this account Jeremiah Block Kenneth Block Georgette Heyer
Copyright © 2003 Addison-Wesley Key Attributes Entity ClassKey AttributeComment Customer of BigHit Video account IDThis value is assigned by the BigHit Video information system when a new customer is entered into the database. Working person in the United States Social Security number Each person who is allowed to work in the United States must have a Social Security number. The U.S. Social Security Administration assigns these numbers on request and ensures that no two people have the same number. Online customer of BigHit Video addressEach online user of the BigHit Video rental system must provide an e- mail address to uniquely identify this user. DVD videoUPC number (bar code) Items that are available for retail sale in the United States have unique Universal Product Code (UPC) numbers. These numbers are assigned by the Uniform Code Council. BookISBN numberEvery commercially published book has a unique identifier that is assigned by the publisher in cooperation with the International Standard Book Numbering Association.
Copyright © 2003 Addison-Wesley Entity Classes with Attributes Entity ClassAttributeConstraints or Further Description CustomeraccountId Key lastName Not null firstName address balance Currency otherUsers numberRentals Derived VideovideoId Key title Not null genre dateAcquired rating PayStatementdatePaid hoursWorked amountPaid
Copyright © 2003 Addison-Wesley Sample Customer Entities Account Id Last Name First Name addressOther Users number Rentals balance streetcitystateZip code 101BlockJane1010 Main St. ApopkaFL30458Joe Block, Greg Jones HamiltonCherry3230 Dade St. Dade City FL HarrisonKate103 Dodd Hall ApopkaFL BreauxCarroll76 Main St. ApopkaFL30458Judy Breaux, Cyrus Lambeaux, Jean Deaux
Copyright © 2003 Addison-Wesley Discovering Relationships A relationship is a connection between 2 entities –Customer Jane Block rents the video with videoId A relationship type between 2 entity classes represents the possibility that two entities may be related –A customer may rent a video Attributes and relationship types are not the same –The customer accountId is not an attribute of the Video entity class What are the relationships, entities and attribute values in this video rental receipt? What entity classes, attributes and relationship types are implied by the video rental receipt? BigHit Video Rental Receipt Account ID: 101 video ID: Date: January 9, 2002Cost: $2.99 Jane Block 1010 Main St. Apopka, FL ElizabethDate due: January 11, 2002
Copyright © 2003 Addison-Wesley Relationship Cardinalities A relationship type may be limited in how many relationships an object may have The cardinality of a relationship type may be –One-to-one: Each object of a class may have no more than one object of the other class –One-to-many: One of the classes allows and entity to have any number of related entities, but the other class restricts its entities to be related to no more than one entity. –Many-to-many: Entities of both classes may have any number of related entities of the other class. Examples below for one-to-many and many-to-many
Copyright © 2003 Addison-Wesley Case in Point Determining entity classes, attributes and relationship types for BigHit Online video sales Process –Evaluate statement of goals for information system –Define entity classes –Define attributes for entity classes –Define relationship types –Determine cardinalities of relationship roles –Add attributes to relationship types as necessary –Evaluate entity classes, attributes, and relationship types for clarity, accuracy, and completeness
Copyright © 2003 Addison-Wesley Statement of Goals Statement of goals is highlighted to identify different kinds of information
Copyright © 2003 Addison-Wesley Define Entity Classes and Attributes
Copyright © 2003 Addison-Wesley Define Relationship Types Relationship TypeEntity Class Cardinality RatioAttibutes PurchasesCustomerSale one-to-many IncludesSaleMovie many-to-many quantity SelectsCustomerShoppingCart one-to-many IncludesShoppingCartMovie many-to-many quantity
Copyright © 2003 Addison-Wesley