120 likes | 268 Views
5. Data Modeling. J. Stephen Schiavo Missouri Southern State University. Introduction. Model: A representation of reality Logical model: the essence of the system Not constrained by platform or technology
E N D
5. Data Modeling J. Stephen Schiavo Missouri Southern State University
Introduction • Model: A representation of reality • Logical model: the essence of the systemNot constrained by platform or technology • Physical model: Includes implementation detailShows how implementation problems overcome • Data model: Detailed, organized description of the information that is critical to the enterprise • Shared • Stable • Simple, small • Aid in communication and agreement
Systems Concepts: Entities • Entities: “nouns” • People :Customers, Employees, Students, Faculty, … • Places : Stores, Dorms, Classrooms, Plants, … • Things : Vehicles, Houses, Products, Parts, Courses, … • Instance • Individual specimen of an entity • Record, member, individual • Independent entity (exists solely in its own right) • Associative Entity (requires existence of other entity)
Systems Concepts: Attributes (adjectives) • Compound attribute (Area code & Phone num.) • Type (Number, Text, Memo, Y/N, Date-time, …) • Domain (All possible values: pos. integers, states, …) • Default (Assumed usual value in a new record) • Subset criterion – Used to group instances • Gender: M or F • EmplEthnic: “Cauc”, “AfrA”, “Hisp”, “NatA”, “PacI”, “AsiA” • Class: “Fr”, “So”, “Jr”, “Sr”, “NA”
Index Systems Concepts: Keys • Primary key: unique identifier for each instance • Concatenated key (compound key) • Candidate & alternate keys • Foreign keys • Secondary Indexes • Associative Entity: compound key from others
Systems Concepts: Transactions • Entities interacting with each other • CustomerbuysProduct • Studentenrolls in Class • SellerlistsHome • MechanicrepairsVehicle • Transactions provide the life of the model • Often result in familiar paper: PO, Invoice, Grades
Systems Concepts: Relationships • How entities relate to one another and to other tables • One-to-one : Each Sales-rep has a company car • One-to-many : Each Sales-rep has several clients • Many-to-many (nonspecific) ; Each client buys N products; product bought by M clients • Cardinality (How many children a parent can have.)Exactly one; One or more; Zero or one; Zero or more; etc. • Degree: How many entities comprise the relationship • Recursive relationships
Diagramming Conventions:Recursive Relationships • Where one member of a table refers to another member of the same table • PREREQUISITE field in the COURSE table • ROOMMATE field in the RESIDENT table • SUPERVISOR field in the EMPLOYEE table • UNDERSTUDY field in the ACTOR table Often best to use an arrow to show direction of relation as described Resident Rooms with …
Strategic Data Modeling • Enterprise Data Model • Highest level entities only, w/o attributes • Guide to fleshing out the model as applications arise • Application data model • Critical for clarity in analysis phase ! • Identify local vocabulary • Proceed at high level of abstraction • New system can retain much in common with old system
More Concepts • C-A-S-E: Use-Cases (“youss-cases”) • Context Data Model (without attributes) • Keys & Key-Based Models (primary & foreign keys) • Normalization– Getting it right.
Normalization of the Data Model 1 • 1 NF First Normal Form:1 Record per key; 1 value per field • 2 NF: Where there’s a -part key, both parts must determine every attribute • 3 NF: Consider the fields City - State - ZIPNo field can be a consequence of a non-key field 1 1 2 2 3 3 The key; the whole key; nothing but the key!