Weak Entity Sets A weak entity is an entity that cannot exist in a database unless another type of entity also exists in that database. Weak entity meets.

Slides:



Advertisements
Similar presentations
ER Modeling Case Studies
Advertisements

Temple University – CIS Dept. CIS616– Principles of Database Systems
Chapter 6: Entity-Relationship Model (part I)
Prof. Sin-Min Lee Department of Computer Science
ER Modeling Case Studies
Enhanced Entity-Relationship Modeling. Strong and Weak Entity Types Strong entity: Each object is uniquely identifiable using primary key of that entity.
Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the.
Entity-Relationship Models
Entity Relationship (ER) Modeling
Text-Book Chapters (7 and 8) Entity-Relationship Model
ENTITY RELATIONSHIP DATA MODEL ELIZABETH GEORGE. INTRODUCTION Architect Aeronautical engineers Computer architects Traffic engineers.
The Enhanced E-R (EER) Model
EXTENDED-ER (EER) MODEL CONCEPTS. Enhanced-ER (EER) Model Concepts  Basic ER diagram + more concepts =EER model  Additional concepts:  Subclasses/superclasses.
Data Modeling Using the Entity-Relationship Model
Christoph F. Eick: Designing E/R Diagrams 1 Designing E/R Diagrams Updated: January
Data Modeling Using the Entity-Relationship Model
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
the Entity-Relationship Model
Entities and Attributes
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Practice of ER modeling
1 CSE 480: Database Systems Lecture 4: Enhanced Entity-Relationship Modeling Reference: Read Chapter 8.1 – 8.5 of the textbook.
ER Data Models Ctd. CSET 3300.
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.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
The Hong Kong University of Science and Technology COMP3311 Spring 2013 Tutorial 1 ER Diagrams.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
Data modeling using the entity-relationship model Chapter 3 Objectives How entities, tuples, attributes and relationships among entities are represented.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Continued)
Entity Relationship Diagram (2)
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
Entity Relationship Modeling
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Entity-Relationship Model Chapter 3 II COSC 457 Sungchul Hong.
Data Modelling Using Entity-Relationship (ER) Model
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. – (customer-id, account-number)
advanced data modeling
Enhanced Entity-Relationship Modeling
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
CST203-2 Database Management Systems Lecture 4. Student entity NIDFNameLNameRegNoExamIdBirthdate.
Introduction to Database Systems
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship.
Chapter 4_part2: The Enhanced Entity-Relationship (EER) Model.
Entity Relationship (E-R) Model
Contents Design Process Modeling Constraints E-R Diagram Design Issues
Comp 1100 Entity-Relationship (ER) Model
Databases (CS507) CHAPTER 7.
Enhanced Entity-Relationship and Object Modeling Objectives
E-R Diagram (Cont.) Draw ER Diagram for the following scenario:
Entity-Relationship Model
Database EER.
Outline of the ER Model By S.Saha
Lecture3: Data Modeling Using the Entity-Relationship Model.
بسم الله الرحمن الرحيم.
Data Modeling with Entity Relationship Diagrams (Cont.)
CS4222 Principles of Database System
Chapter 6: Entity-Relationship Model
Chapter 7: Entity-Relationship Model
ER Modeling Case Studies
Chapter 7: Entity-Relationship Model
Database EER.
Entity Relation Model Tingting Zhang.
Presentation transcript:

Weak Entity Sets A weak entity is an entity that cannot exist in a database unless another type of entity also exists in that database. Weak entity meets two conditions Existence-dependent Cannot exist without entity with which it has a relationship Has primary key that is partially or totally derived from parent entity in relationship Weak entities cannot exist without the identifying relationship. Weak entities do not have primary key attribute(s) of their own. They may have partial key. Partial Key: Portion of the key that comes from the weak entity. The rest of the key comes from the other entity in the relationship.

Weak Entity is represented by double rectangle Weak Relationship is represented by double diamonds Many-one (or one-one) relationship sets are required Weak Entity Sets (cont.)

Example: – Transactions of different accounts could have the same trans#, so “trans#” cannot be a key – By borrowing attribute “number” from “account,” we have a key for “transaction.” – “Transaction” is a weak entity set related to accounts via log relationship. account number balance trans# log transaction

Weak Entity Sets (cont.) Key of weak entity set = key of strong entity set(s) + partial key account number balance trans# log transaction amount

Chain of Weak Entity Sets State name forms a key. City names are unique only within a state (e.g., 24 Springfield’s within the 50 states). Street names are unique within a city. Multiple cities could have streets with the same name (e.g., “Main”). A weak entity set might itself participate as owner in an identifying relationship with another weak entity set. city state street Located in stateName cityName stName governor population #ofHome s

Weak entity set examples! Seats in rooms in buildings EXAMPLE

Design a database representing cities, counties, and states  For states, record name and capital (city)  For counties, record name, area, and location (state)  For cities, record name, population, and location (county and state) Assume the following:  Names of states are unique  Names of counties are only unique within a state  Names of cities are only unique within a county  A city is always located in a single county  A county is always located in a single state CASE STUDY

DESIGN 1

DESIGN 2

The company is organized into departments. Each department has a name, a unique number, and a particular employee who manages the department. We keep track of the start date when that employee began managing the department. A department may have several locations. A department controls a number of projects, each of which has a name, a unique number, and a single location. We store each employee’s name, SSN, address, salary, sex, birth date, and age. An employee is assigned to one department but may work on several projects, which are not necessarily controlled by the same department. We keep track of the number of hours per week that an employee works on each project. We also keep track of the direct supervisor of each employee. Each employee may have only one direct supervisor. We want to keep track of the dependents of each employee for insurance purpose. We keep each dependent’s first name, sex, birth date and relationship to employee. Exercise 1

A college course is taught by many instructors, and an instructor may teach many courses. A course may have one or more scheduled sections, or may not have a scheduled section. Attributes of COURSE include courseID, coursename, and credits. Courses are identified by courseID. Attribute of a SECTION of a course include courseID, sectionID, semesternumber, year, and instructorID. A Section is belong to only one course. Sections are identified by courseID and sectionID together. Only one instructor is responsible for a given section of a course. An INSTRUCTOR is identified by an instructorID. Additional information we want to store about an instructor includes the lastname, firstname, address and officenumber. Exercise 2

INHERITANCE MODELLING ISA relationship In some problems, we see entities that are types of or specializations/generalized of other entities. For these situations we use inheritance relationship. (Also known as ISA relationship). Superclass (generalzied) SubClasses (Specialized) METHOD I Person StudentEmployee natid Nationality name address cgpa salary ISA

What are the keys of: 1.Movie Person 2.Actor 3.Director EXAMPLE Movie Person Actor id name address birthday picture Director IS A

INHERITANCE MODELLING ISA relationsip METHOD II We might have Constraints for the inheritances such as Disjoint or Overlap. Superclass (generalized) SubClasses (Specialized) CONSTRAINTS WILL BE INDICATED HERE!!!! Person StudentEmployee natid Nationality name address cgpa stdid empno salary

Specialization – process of taking an entity and creating several specialized subclasses Generalization – process of taking several related entities and creating a general superclass Specialization & Generalization

Disjointness constraint – specialization is disjoint or overlapping Completeness constraint – specialization is total or partial Specialization constraints

Specifies that an entity can be a member of at most one subclass There can be no overlap between the subclasses We use the notation of a d in a circle to symbolize that the subclasses are disjoint Disjointness constraint

Disjoint constraint

Entities are able to belong to more than one subclass Notation is an o inside of a circle Overlap

Overlap constraint

May be total or partial For total, every entity in the superclass must belong to a subclass For partial, entities in the superclass do not need to be part of any subclass Notation for total and partial are the same as in a regular E-R diagram – single and double lines Completeness Constraint

Partial

Total

Account Checking Account Saving Account d An Entity can be either a savings account or a checking account, but cannot be both. Examples

Person CustomerEmployee o A Person can be both an Employee and a Customer. Examples

Computer LaptopServer o Is it Partial? If yes why? Yes it is Partial. Because, there are some computers that they are neither Server nor Palmtop. Examples

It is Partial, because we can have cars, bike and etc. Vehicle Bus Truck d Examples

Student d Parttime Fulltime It’s Total, because we have either part time or full time students. No other options!!!! Examples

Person EmployeeStudent d partial d o Parttime Fulltime SecretaryDriver partial Instructor An Employee can’t be a Secretary and an Instructor. (disjoint) (Can be Clerk or Doctor or etc…) **partial** There can be a Person who is both Student and Employee. (overlap) (A Person may belong to more than one of its subclasses) **partial** The Student has to be Parttime or Fulltime. Not BOTH!!! (disjoint) (A Student has to belong to any of its subclasses) **total** total Examples

Design a database consistent with the following:  A station has a unique name and an address, and is either an express station or a local station  A train has a unique number and an engineer, and is either an express train or a local train  A local train can stop at any station  An express train only stops at express stations  A train can stop at a station for any number of times during a day  Train schedules are the same everyday Case Study

DESIGN 1

DESIGN 2

There are many students at the university. Students are subdivided into graduate and undergraduate students. Students take a course in a particular semester and receive a grade for their performances. Sometimes students take the same course again in a different semester. There are no limits on how many courses a student can take. Each graduate student has exactly one advisor, who must be a professor, whereas each professor is allowed to be the advisor of at the most 20 students. Courses have a unique course number and a course title. Students and professors have a name and a unique identification no (assume that both professor and student are subclasses of Person Class); students additionally have a gpa, and undergraduate students have many majors. Professors can be students and take courses, but graduate students cannot be undergraduate students. Clearly indicate the Primary Keys. EXERCISE :