Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Modeling I The cautious seldom err. Confucius.

Similar presentations

Presentation on theme: "Database Modeling I The cautious seldom err. Confucius."— Presentation transcript:

1 Database Modeling I The cautious seldom err. Confucius

2 Class Outline u What are the steps in designing databases? u How does one collect information necessary to design a database? u Why is modeling important? u What are the basic elements of a database model? u How are the following represented in a database model? l entity l attribute l degree of relationship l connectivity l cardinality l binary M:N relationships l participation

3 A good designer combines the art of design with the science of design. Characteristics of a Database designer u Knowledge of the problem you are trying to solve u Communication skills - extensive discussions with users u Analytical aptitude - keep in mind the broad goals even while poring over the smallest details u Impertinence - question everything! u Impartiality - find best solution u Relax constraints - assume anything is possible u Pay attention to details and definitions u Reframing - iteratively analyze in new way - be creative!

4 1.Define the problem and define database objectives 2.Analyze current database, assess user requirements, and create data model 3.Design data structures (tables, fields, field specifications, establish keys) 4.Establish table relationships 5.Clarify business rules critical to database design (e.g., required fields, validation rules) 6.Determine and establish user views of data 7.Review data integrity and reiterate design methodology Conceptual Design Methodology

5 Statement of Purpose 1.Declare a specific purpose for the database to focus and guide its development e.g., “The purpose of the All-Star Talent database is to maintain the data we use in support of the entertainment services we provide to our clientele.” 2.Articulate goals & objectives that define specific tasks “We need to maintain complete entertainer information.” “We need to maintain complete customer information.” “We need to track all customer-entertainer bookings.” “We need to maintain financial records of both payments from customers and payments to entertainers.”

6 Assessment of User Requirements: What is analyzed? u interview transcripts u meeting minutes u observational notes u business mission and strategy statements u questionnaire results u document analyses l business forms l reports l flow charts l presentations l computer-generated output l training manuals l consultant reports l job descriptions

7 Assessment of User Requirements: Specific requirements u What are subjects/objects for the business? u What characteristics describe each object? u What unique characteristic distinguishes each object from other objects of the same type? u How do you use this data (e.g, summary reports)? u Over what period of time are you interested in this data? u Are all instances of each object the same? u What events occur that imply associations between various objects? u Is each activity or event always handled the same way or are there special circumstances? Goals of analysis of user requirements: collect a list of business goals, entities to track, a database schema, and sample report outputs.

8 Rules for Conducting User Interviews u Create a quiet, stress-free environment; set a limit of six people u Have an agenda - provide it to participants ahead of time u Focus on the problem at hand; maintain control of the interview u Conduct separate interviews for users and management u Identify the decision maker u Avoid technical jargon u Show concern for user needs u Give everyone equal and undivided attention u Write down everything where it can be seen by participants u Encourage ‘blue sky’ thinking u Arbitrate disputes u Keep the pace of the interview moving u Don’t foreclose your options too soon

9 Data Modeling u A model is a simplified representation (usually a graphic) of a complex object in reality to make it understandable u If the elements in the model are correctly associated with elements in reality, the model can be used to solve problems in reality (e.g., engineer’s model to determine a bridge’s weight tolerance; if the model is incorrect...) u an ER model is integrated set of concepts that describes data, relationships between data, and the constraints on the data as they are used within a specific organization; a data model renders organization’s (users’) view of objects and/or events and their associations u ER model is a blueprint from which a well-structured database is created u ER models are independent of details of implementation

10 E-R Modeling Concepts Objects Entities Relationships Attributes Relationship Type Degree Values Domains 1 : 1 1 : N M : N Mandatory Optional Connectivity Participation Recursive Binary Ternary N-ary Cardinality

11 Entities u Entity l Something that can be identified in the users’ environment about which we want to store data; typically is a noun l Entities or objects must have occurrences that can be uniquely identified l Identified by an organization or its users l Consists of tangible or intangible objects or events u Entity Instance l A single entity occurrence or instance within a collection of entities e.g., STUDENT is an entity; Annie Abel is an entity instance as are Bob Brown and Cathy Chen. STUDENT

12 Attributes u properties that describe characteristics of an entity - assumed all instances of a given entity have the same attributes l use atomic attributes, those that cannot be divided further (e.g., not composite attributes (e.g., use last name & first name, not name) l do not use derived attributes (attributes that can be calculated using other attributes; e.g., age) l use single value attributes not multi-valued (e.g., medication1, medication2, etc.) l multi-valued attributes, if they have their own important attributes should be elevated to entities e.g., attributes of the entity STUDENT might include name, address, etc. STUDENT birth datefirst name last name photophone #

13 Identifier u Each entity occurrence has a unique identifier u The identifier is an attribute (or group of attributes) that describes or identifies each entity occurrence u An identifier should be unique to each occurrence u Referred to as a ‘primary key’ in relational models STUDENT e.g., in the list of potential attributes of the entity STUDENT, the identifier could be Student Number. StudentID

14 Relationships u Association or connection between two or more entities l Usually a verb l HAS-A is also a common relationship (EMPLOYEE-has a-DEPENDENT) l E-R model also contains relationship classes STUDENT takes COURSE StudentIDCourseID

15 Degree of Relationship: Binary In a binary relationship, two entities are associated. This is the most common degree of relationship. VACATIONER takes TRIP EMPLOYEE DEPARTMENT works for

16 Degree of Relationship: Ternary In a ternary relationship, three entities are associated creat e DESIGNER WRITERILLUSTRATORCUSTOMERWAREHOUSE ITEM order

17 Degree of Relationship: Unary (Recursive) In a recursive relationship, one entity is associated with itself TEAM plays COURSE requires

18 ChildToy EmployeeOffice MusicianSong One-to-Many One-to-One Many-to-Many 1M M 1 N 1 Connectivity u Connectivity describes constraints on relationship (also referred to as “maximum cardinality”) u Number of instances of entity B that can (or must) be associated with each instance of entity A rents has sings

19 Representing M:N binary relationships u M:N relationships are represented by two 1:M relationships. u the relationship is itself an entity, called a composite entity (rectangle around the diamond) u The composite entity often has its own attributes STUDENTCLASS enrolls in MN STUDENTCLASS enrolls in MM DateMark 11

20 Cardinality u Cardinality is the specific number of entity occurrences associated with one occurrence of the related entity u often referred to as ‘business rules’ because cardinality is usually determined by organizational policy ChildToy 1M e.g., at a toy lending library, a given child may not borrow any toys at all or borrow more than one (up to 3) toys. A toy may not be borrowed by anyone, or it may be borrowed by one child. (0,3)(0,1) borrows

21 Occurrences Diagram Pictorial mapping of the occurrences between two entities assists in understanding connectivity, cardinality C1T1C2T2C3T3C4T4C5T5C6 T6C1T1C2T2C3T3C4T4C5T5C6 T6 A child may rent between 0 and 3 toys; a toy may only be rented by 0 or 1 child. One child may rent many toys (1:M)

22 Relationship Participation u Also referred to as “minimum cardinality” u Mandatory Participation l An instance of a given entity must definitely match an instance of a second entity l e.g., each student must enroll in exactly one course u Optional Participation l An instance of a given entity does not necessarily participate in the relationship l lower bound of cardinality is zero l e.g., a faculty member teaches zero, one, or two courses makes 1 MEMBER DONATION OPTIONALMANDATORY N (0,N)(1,1) a member may or may not make a donation but a donation must be associated with a member

23 u From the CUSTOMER perspective: –a customer may make many orders (M orders of 1:M connectivity) –a customer does not necessarily make orders (optional participation of orders, cardinality is (0,N)) u From the ORDER perspective: –an order is made by (associated with) one and only one customer (1 customer of 1:M connectivity) –an order must be made by (associated with) a customer (mandatory participation, cardinality is (1,1)) CUSTOMERORDER makes 1M (0,N)(1,1) Example: Customers & Orders

24 parent table related table common field

Download ppt "Database Modeling I The cautious seldom err. Confucius."

Similar presentations

Ads by Google