Database Principles Entities and Relationships. Database Principles What is an Entity? Something of interest, capable of independent existence A “stand.

Slides:



Advertisements
Similar presentations
More Diagramming & Practice with Relationship Modeling
Advertisements

Entities and Relationships
Chapter 6: Entity-Relationship Model (part I)
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
Design Principles: Faithfulness
Design Principles: Faithfulness
CS157A Lecture 3 ER Diagram Prof. Sin-Min Lee Department of Computer Science San Jose State University.
ER Modeling An E-R model is a conceptual (or logical) data model that includes –Entity (classes) –Attributes of each entity –Relationship types between.
Agenda for Week 1/31 & 2/2 Learn about database design
The Relational Database Model:
Ch5: Software Specification. 1 Descriptive specifications  Describe desired properties of system  Three types:
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Week 3 Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model.
Entity-Relationship Modelling Introduced by Chen in 1976 The ER Model is used to construct the conceptual data model – independent of DBMS Most widely.
Database Design Chapter 2. Goal of all Information Systems  To add value –Reduce costs –Increase sales or revenue –Provide a competitive advantage.
Database Design Concepts Info1408
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Chapter 3)
CSCI 242 Relational Data Modeling Copyright 2011, David C. Roberts, all rights reserved.
Data Modeling 1 Yong Choi School of Business CSUB.
CSCI 6442 Entity-Relation Data Modeling Copyright 2012, David C. Roberts, all rights reserved.
Data Modeling 1 Yong Choi School of Business CSUB.
Yong Choi School of Business CSUB
CS 405G Introduction to Database Systems
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Data Modeling Using the Entity-Relationship Model
1 Web-Enabled Decision Support Systems Entity-Relationship Modeling Prof. Name Position (123) University Name.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model.
Lecture 2: Entity-Relationship Modeling
Entities and Attributes
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
Principles of Database Systems With Internet and Java Applications Today’s Topic Chapter 2: Representing Information with Data Models The lecture notes.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Data Modeling Using the Entity-Relationship
Entity-Relationship Model Ch. 3
Copyright Ó Oracle Corporation, All rights reserved. Normalization Use the student note section below for further explanation of the slide content.Use.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
1 A Guide to MySQL 2 Database Design Fundamentals.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship.
IMS 4212: Introduction to Data Modeling 1 Dr. Lawrence West, Management Dept., University of Central Florida Introduction to Data Modeling—Topics.
1 Entity-Relationship Diagram. 2 Components of ERD: –Entity –Relationship –Cardinality –Attributes.
Section 08 (a)ER Modelling In Practice1 HSQ - DATABASES & SQL And Franchise Colleges 08 (a) ER Modelling In Practice QUICKHIRE Car Company.
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
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.
ERD ( Conceptual data model From the statement of data requirements a conceptual data model is produced. This describes.
Carnegie Mellon University © Robert T. Monroe Management Information Systems Data Modeling Management Information Systems Robert.
Entity Relationship Modeling
MIS2502: Data Analytics Relational Data Modeling
Data Modeling Using the Entity-Relationship (ER) Data Model.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 2 © Akhilesh Bajaj, 2000, 2002, 2003, 2004,
Data Modeling Using the Entity- Relationship (ER) Model.
Link tables and keys Access/IPS Walsall College of Arts & Technology.
EntityRelationshipDiagrams. Entity Relationship Models The E-R (entity-relationship) data model views the real world as a set of basic objects (entities)
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
1 Information System Analysis Topic-3. 2 Entity Relationship Diagram \ Definition An entity-relationship (ER) diagram is a specialized graphic that illustrates.
IMS 6217: Database Design & Entities 1 Dr. Lawrence West, MIS Dept., University of Central Florida Database Design--Topics DB Design.
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.
Data Modeling and Entity-Relationship Model I
IMS 6217: Introduction to Data Modeling 1 Dr. Lawrence West, MIS Department, University of Central Florida Introduction to Data Modeling—Topics.
Topic 3: ER – Entity Relationship Model (ERM) 6/12/
Entity Relationship Diagram ERD. Background Peter Chen developed ERDs in Charles Bachman and James Martin have added some slight refinements to.
Contents Design Process Modeling Constraints E-R Diagram Design Issues
Chapter 7: Entity-Relationship Model
MIS2502: Data Analytics Relational Data Modeling
MIS2502: Data Analytics Relational Data Modeling
MIS2502: Data Analytics Relational Data Modeling 2
Presentation transcript:

Database Principles Entities and Relationships

Database Principles What is an Entity? Something of interest, capable of independent existence A “stand alone” thing or a concept A type of thing such as Automobile and not “my car”. Something with properties. –EMPLOYEE is an entity with property SALARY –SALARY is not an entity because if I say SALARY you say, “Whose?” In other words, a SALARY only makes sense if we are talking a some EMPLOYEE so it is not “capable of independent existence”. In sentences, entities show up often as nouns; unfortunately, so do properties. Check out Wikipedia and what it says about entities.

Database Principles Exercise: Working in pairs come up with a list of (Entity,Property) pairs. Both people in the pair need to agree. Don’t throw the pairs away, you’ll need them later. EntityPropertyok?Reason AmazonSeattlenoAmazon is an entity instance; Seattle is a property value CompanyLocationyes ElephanttusknoTusk is a value of Body Part; an entity. BookPublisheryesbut both are entities StudentAdvisorNamenoAdvisorName is property of Advisor entity

Database Principles What are Properties: The fact that an entity has a property often represents a specific business rule. A business or organization is run by rules. It is a well- known secret among database designers that the process of designing a database is that of capturing, in an unambiguous way, the rules of a business or organization. The above is a business rule captured in the Entity- Relationship language by representing Salary as a property of the entity, EMPLOYEE. Every employee earns exactly one salary

Database Principles Exercise: Go back to your (Entity,Property) pairs and express the related business rules. What “business” is each pair a part of?

Database Principles Exercise: A database designer is in a unique position to understand how a business is run. Discuss. How could a database designer beneficially use this power? How could a database designer detrimentally use this power?

Database Principles How do we picture an Entity? EntityName List of some of its properties

Database Principles Was it always this way? No Chen’s early notation, called a “Bubble Diagram”. EntityName Property 1 Property 2...

Database Principles Exercise: Discuss the pros and cons of each approach to drawing an entity.

Database Principles Notational Confusion: Chen called EMPLOYEE an entity type and Andrew Pletch an entity. Other people said, if there is no confusion let’s drop the “type” and call EMPLOYEE an entity and Andrew Pletch an entity instance (or just an instance). So Chen’s original approach should have been called the We will use the terms entity and (entity) instance. In some sense, an entity represents the set of its instances. Entities are usually identified in the singular Entity-Type Relationship-Type Approach

Database Principles Just to make it clear: Exercise: Why call it EMPLOYEE and not EMPLOYEES? EMPLOYEE EmployeeID FName LName DOB Salary This is an ENTITY This is a group of entity instances

Database Principles Exercise: Work in small groups. In the following paragraph identify things you think are entities and things you think are properties of entities. You can also consider things that are implicitly (not explicitly) referred to in the paragraph. Note that a property that is also an entity can have additional properties of its own. The College at New Paltz is one of the campuses of the State University of New York. It is a liberal arts college with programs in arts, fine arts, business, science and engineering. Its faculty and students come from all over the state, the United States and the world.

Database Principles What’s in a Name? A rose, by any other name … It turns out, in database at least, a name is not enough. Both these sets of instances can legitimately be called instances an entity called CAR but they are NOT instances of the same thing, are they? CAR What are this entity’s instances? { VW Passat, Honda Accord, Toyota Corolla, Ford Escort,... } { My car, My son’s car, My wife’s car, Your car,... }

Database Principles Exercise: How can the following been seen as different types of Entities? –BOOK, PRODUCT, COURSE Give me an example of something else with multiple meanings. Keep these examples around for a couple of slides

Database Principles Attributes: Some properties of entities are called attributes. Among the attributes of an entity there are some that identify the entity. These are called key attributes. No two different instances of an entity have the same values for their key attributes. { VW Passat, Honda Accord, Toyota Corolla, Ford Escort,... } { My car, My son’s car, My wife’s car, Your car,... } CAR Make Model VIN underscore key attributes

Database Principles The Key to Power; the Power of the Key Keys are also called unique identifiers. What is an identifier? What is a unique identifier? In the Earthsea Trilogy by Ursula Le Guin, a story about a mage called Ged, people or things would be “under your control” if you knew their true name. In database you “control/know” an entity if you know its key attributes. If you don’t, you don’t!! (CAR??) This is the first hint that in Entity-Relationship we are going to insist that we know what we are talking about. It turns out that as a language, Entity-Relationship is well-defined. What does well-defined mean?

Database Principles Exercise: Returning to our previous example: –What different keys are possible for BOOK, PRODUCT and COURSE?

Database Principles Keys vs Entities There is a one-to-one correspondence between the distinct values of a key attribute and the instances of the corresponding entity. Keys are surrogates for Entities – we can store key values where we can’t store entity instances. Exercise: Identify the keys for the following entities BOOK CAR MEDICAL PROCEDURE PROFESSOR PROCESS APARTMENT COURSE {ISBN},{Author,Title} {VIN},{License Number} {Name},{Procedure Number} {Name}, {SSN} {ProcessID} {BuildingName,ApartmentNum} {Crs#,Sec#},{Crs#,Sec#,Sem}

Database Principles Context: Notice that things exist in a “context” and that unless the context is clear, assignment of keys is not easy. For example, the context for identifying the key to Course to be the (Crs#,Sec#) pair is that we are only talking about a single semester and not multiple semesters. If you broaden the context, then something needs to be added to the key that helps distinguish between instances in different contexts. Historically, the new key to Course would be (Crs#,Sec#,Sem).

Database Principles A Final Word (or Two) on Keys: Things with the same key value are the same thing! An Entity can have multiple, alternative keys. Give an example.

Database Principles A final word on attributes: Although it is not a hard-and-fast rule, in this course we will insist that attributes be single-valued. In other words, not records and not lists. EMPLOYEE EmployeeID FName LName Address{ Street City, State, Zip} List_of_Jobs key attribute good examples of attributes bad examples of attributes NOTE: Any attribute name that is expressed in the plural is probably a list so badly designed.

Database Principles Exercise: Let’s revisit the exercise we worked on a while ago. Suppose these are our entities: Add some suitable attributes and underscore the key attributes. The College at New Paltz is one of the campuses of the State University of New York. It is a liberal arts college with programs in arts, fine arts, business, science and engineering. Its faculty and students come from all over the state, the United States and the world. CAMPUSPROGRAMFACULTYSTUDENT Name Location CampusType Num_Faculty Num_Students Name Telephone Num_Depts Num_Faculty Num_Students SSN FName LName Office_Num Telephone StudentID FName LName Address Telephone