MIS 7003 MIS Core Course The MBA Program The University of Tulsa Professor: Akhilesh Bajaj Introduction to Database Design All Slides in this presentation.

Slides:



Advertisements
Similar presentations
Enhanced Entity-Relationship Modeling. Strong and Weak Entity Types Strong entity: Each object is uniquely identifiable using primary key of that entity.
Advertisements

1 Database Design I: The Entity- Relationship Model Chapter 5.
Data Modeling (CB 12) CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
The Entity-Relationship Model
The Entity-Relationship Model Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Text-Book Chapters (7 and 8) Entity-Relationship Model
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
1–1 The E-R Model Prof. Sin-Min Lee Department of Computer Science.
Enhanced Entity-Relationship Modeling
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
1 Data Modelling Which data to include in the database.
Data Modeling 1 Yong Choi School of Business CSUB.
Mapping ERM to relational database
Data Modeling Using the Entity-Relationship Model
Data Modeling Using the Entity-Relationship Model
1 Web-Enabled Decision Support Systems Entity-Relationship Modeling Prof. Name Position (123) University Name.
Conceptual Modeling with ER Diagrams Peter Chen introduced ER Diagrams.
Entities and Attributes
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Entity-Relationship Model
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
DATABASEMODELSDATABASEMODELS  A database model ◦ defines the logical design of data. ◦ Describes the relationships between different parts of data.
Association Class Generalization/Specialization Whole-Part Page More Associations 1.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 1 © Akhilesh Bajaj, 2000, 2002, 2003, 2004.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 7 Database Design and The E–R Model. 2 Goals n Facilitate DB design and represent the overall logical structure of the DB. n Definition Entities.
1.  An introduction to data modelling  The purpose of data modelling  Modelling data relationships 2.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj InClass ER Examples.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 4 Mapping an ER model to tables © Akhilesh Bajaj,
©Silberschatz, Korth and Sudarshan2.1Database System Concepts DB Schema Design: the Entity-Relationship Model What’s the use of the E-R model? Entity Sets.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
ITEC 3220A Using and Designing Database Systems Instructor: Prof Z. Yang Course Website: 3220a.htm
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Entity-Relation Model. E-R Model The Entity-Relationship (ER) model was originally proposed by Peter in 1976 ER model is a conceptual data model that.
Database and Information Retrieval System
MIS2502: Data Analytics Relational Data Modeling
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 2 © Akhilesh Bajaj, 2000, 2002, 2003, 2004,
CST203-2 Database Management Systems Lecture 4. Student entity NIDFNameLNameRegNoExamIdBirthdate.
Data modeling Process. Copyright © CIST 2 Definition What is data modeling? –Identify the real world data that must be stored on the database –Design.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
MIS3053 Database Design And Applications The University Of Tulsa Professor: Akhilesh Bajaj Normal Forms Lecture 2 © Akhilesh Bajaj, 2000, 2002, 2003,2004.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Chapter 2: Entity-Relationship Model. 3.2 Chapter 2: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 3 © Akhilesh Bajaj, 2000, 2002, All Rights.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Chapter 2: Entity-Relationship Model
Entity-Relationship Model
Enhanced Entity-Relationship and Object Modeling Objectives
Entity-Relationship Model
Entity Relationship Model
Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Chapter 7 Entity-Relationship Model
Outline of the ER Model By S.Saha
Entity-Relationship Model
Chapter 6: Entity-Relationship Model
ITEC 3220A Using and Designing Database Systems
The University of Tulsa Professor: Akhilesh Bajaj
Chapter 7: Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Presentation transcript:

MIS 7003 MIS Core Course The MBA Program The University of Tulsa Professor: Akhilesh Bajaj Introduction to Database Design All Slides in this presentation © Akhilesh Bajaj, All Rights Reserved.

What is a Data Model? A way to structure information fields in the business We want to make sure the same information is not repeated for data entry In a business information system, there is data entry (WRITE) and data querying (reports), also termed READ. While many people can reuse information once it is entered, in reports, (i.e. many READS), we don’t really want duplicate/redundant data entry Why? A data model at the design level allows us to structure the fields so they are entered only once during data entry. This eliminates duplicate work and removes potential for error. We don’t design reports when we develop a data model schema; instead, we only care about the data entry part. We will learn a method to structure our fields: Entity Relationship Diagramming.

Entities & Entity Sets An entity is a “thing” or “object” in the real world that is distinguishable from other objects. An entity set (or entity class) is a set of things or objects that are described by the same properties. E.g., Joe Dahmer is a person. “Persons” is an entity class described by, say, name, address, height, weight, fingerprint, age and gender. Hence, Joe Dahmer, who is an element of the entity set “persons” is described by these properties. In the example above, Joe Dahmer is the entity and “persons” is the entity class or entity set. Consider 2 entity sets, “employees” and “persons”. “Employees” may be described by additional properties, such as salary and grade. Joe Dahmer could be a member of both sets.

Attributes An attribute is a descriptive property possessed by each element (or entity) in an entity set. E.g., the entity set “persons” in the previous slide has seven attributes. Each attribute is associated with a domain. E.g., name is associated with the character string domain. fingerprint is associated with the JPEG domain. The domain is the set of permitted values of the attribute. The domain is similar to type in programming languages, and the attribute is similar to a variable of that type.

Types of Attributes Single-Valued and Multivalued Attributes Some attributes, such as height, are single valued, i.e., they have only one value at a time. Other attributes, such as dependent_name, may be multivalued, i.e., they can have multiple values at the same time (in this case, if there is > 1 dependent for a person).

Relationships and Relationship Sets A relationship is an association among two or more entities. E.g., Akhilesh (entity) teaches (relationship) MIS7003_fall_2005_sectionA (entity). A relationship set is a set of relationships of the same type. E.g., Professors (entity set) teach (relationship set) course_sections (entity set). Relationship sets relate entity sets in meaningful, real world relationships. Each entity set involved in a relationship set plays a role in that relationship set. E.g., Professors play the role of teachers in the teach relationship set. Course_sections play the role of taught by in the teach relationship set.

Attributes of Relationship Sets An attribute of a relationship set is very similar to an attribute of an entity set. Attributes of relationship sets are used when we are trying to capture additional information about the relationship set. E.g., the teach relationship set may have the attributes date_began, date_ended. These 2 relationship set attributes of the teach relationship set tell us the beginning and ending dates that the course_section was taught. Each relationship in the relationship set will have values for the relationship set attributes. So, the relationship Akhilesh teaches MIS7003_fall_2009_sectionA will have the values ‘August 20, 2009’ and ‘Dec 3, 2009’ for the date_began and date_ended attributes.

Several software are available for drawing ER diagrams. Each one uses a slightly different convention. We shall use a convention that covers more than almost all conventions, and is as follows: Drawing ER diagrams Entity Set Attribute (underlined if a primary key) Relationship Set

Is it a real-world object? Is it likely to be in relationships with other objects? Is it described by a set of properties? Then Entity set Is it just an attribute of an object? Then attribute Is it a set of arcs or links between objects in two boxes? Then relationship set Examples 1. Should telephone be a telephone_number attribute or an entity set Telephones, described by telephone_ number (and maybe other attributes like phone_type)? 2. Should sale between employee and customer be a relationship or a separate entity set with diamonds (relationship sets) going to customer and employee? Design Issues: Entity Sets or Attributes or Relationship??

Very Important Facts -We never ever,ever repeat anything in the ER diagram. -If we identify a “bunch of objects” each described by the same set of properties (or attributes) then it’s most likely an entity set -If it’s an entity set it will have a primary key. -If it’s a relationship set it will not have its own primary key. It may have some attributes, but it’s really just a “bunch of links” between objects in boxes (entity sets).

Existence Dependencies If the existence of entity x depends on entity y, then if y is deleted, x should also be deleted. E.g., the entity set course_sections is existence dependent on the entity set courses. So, each course_section is dependent on one and only one course for its existence. Thus, this section Fall2009A is existence dependent on the course MIS7003 (if that is how a course is defined). The course can have many sections Other examples of existence dependencies? In the above example, we say that course_sections is the weak entity set, while courses is the corresponding strong entity set. Another way to think: If we talk about the weak entity, we always HAVE to refer to the strong entity. If we say section Fall2009A, the question is: which course are we talking about? In a bank, if we say transaction id3, the question is: which account?

Rule for Determining if a Weak Entity Set is Appropriate We cannot identify the objects in the weak box without the primary key of the strong box.

Existence Dependencies The relationship set between a weak entity set and the corresponding strong entity set is shown differently in an ER diagram. The weak entity set is shown thus: Strong entity set Relationship set showing existence dependency Weak entity set Double Diamond Shows Existence Dependency

An entity set may contain subgroupings of entities that are distinct in some way from other entities in the same set. E.g., The entity set persons contains a subgrouping of persons who are employees. Students may contain undergraduate_students and graduate_students. Subgroupings may be different from the other entities in the set in the sense that they have additional attributes (e.g., graduate_students have an undergraduate_major) or they may be involved in relationships that other entities in the same set are not (e.g., employees participate in the relationship set works_for with the entity set departments). Rule of thumb: At least 2 extra attributes and/or relationships to create a subclass Subclass / Superclass Hierarchies

What are some other examples of this? We say that the superset is the entity superclass, while the subset is the entity subclass. Subclasses inherit all the attributes of their superclass and also participate in all the relationship sets that the superclass participates in. E.g., employees is a subclass of persons. It inherits all the attributes of persons. It participates in all the relationship sets that persons participates in. In addition, it may have some extra attributes, and/or may participate in some extra relationship sets. Subclass / Superclass Hierarchies

Representation of Subclasses and Superclasses Subclass / Superclass Hierarchies Superclass IS A Subclass In this course, a subclass can have one and only one superclass A superclass can have one or more subclasses. Note the inverted triangle: the base is towards the superclass. attribute

Summary of Data Abstraction Patterns Entity set: Bunch of objects, each object described by same set of attributes Multivalued attribute: multiple values at same time for an object in a box Relationship Set: Bunch of arcs or links between objects so that an object is at each end of the link. Identified by primary keys of end points. Weak Entity Set: Needs primary key of another box as well as its own in order to be uniquely identified. Subclass: Extra attributes / relationships of some of the objects in a box are modeled as a separate box so that these objects co-exist in both boxes. Inherits primary key of superclass.

ER Model Example University Schema: Objects: Courses, Course sections, Professors, Students (graduate and undergraduate), Classrooms, buildings Example course numbers: MIS7003, MIS4233, MIS3023. Example course section identifiers: MIS7003Fall2008A, MIS4233Fall2008A Example StudentID: Example FacultyID: Example BuildingID: HELM, OLIP Example classroom ID: HELM316 Events: A student takes a course section and gets a grade, a professor teaches a course section and gets a rating for that course section, a graduate student may TA a Course section, and also get a rating for it. Example grade: ‘A’ Example Professor rating: “Excellent’ Example GA rating: ‘Excellent’ Let us build an ER schema for this description.

In Class Assignment 1 Al’s motor shop (AMS) is an automobile repair facility owned by the Capone family. AMS has 5 repair bays. Each repair bay (place where car is repaired) has a bay_id and bay_location. AMS employs 14 employees. Each employee has an employee_id, address, phone and salary. Of these 14, 2 are office staff. They are further described by typing_speed and degree_held. The 12 mechanics are further described by tech_level. Each mechanic is assigned to work on one bay. AMS customers have a cust_id, name, address, phone. In addition, Mr. Capone also wants to capture information for each customer that lists the mechanic who last did a job for the customer, the date on which the job was done, and the amount the customer paid to AMS. Please capture the above requirements in a DSD diagram.

In Class Assignment 2 Wimpy runs a burger joint. He has 6 employees working for him. Some of these are shift managers, the others are grade 1 workers. Wimpy wants you to capture information on each shift. A shift is 8 hours long. Each shift needs a shift manager and 0 or more grade 1 workers. Being a purist, Wimpy sells only burgers, and only 3 types of burgers at that: the wimpy mini, the wimpy burger and the wimpy super. Each burger type has a price, a recipe and amount of fat calories. In each shift, burgers of all 3 types can be sold. Each shift has a time began and a time ended. Wimpy wants to capture information on how many burgers were sold (of each type) in a shift. Please capture the above requirements in a DSD diagram.

Tables Construction & Foreign Keys Employees (emp_id, phone, address, salary) Mechanics (emp_id, tech_level) emp_id FK REF employees Office_staff (emp_id, typing_speed, degree_held) emp_id FK REF employees Repair_bays (bay_id, bay_loc) Customers (cust_id, name, address, phone) Last_job (cust_id, emp_id, date, payment) cust_id FK REF customers, emp_id FK refs mechanics Works (emp_id, bay_id) emp_id FK REF mechanics, bay_id FK REF repair_bays Tables are different from screens but can be mapped from them. They contain the data at the “back end”. Screens are the “front end”.