1 / 339

Introduction to Entities, Attributes, and Relationships

Introduction to Entities, Attributes, and Relationships. Overview. Why conceptual modeling? Introduction of the Key role players: Entities Attributes Relationships. Why Create a Conceptual Model?. It describes exactly the information needs of the business It facilitates discussion

Télécharger la présentation

Introduction to Entities, Attributes, and Relationships

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Entities, Attributes, and Relationships

  2. Overview • Why conceptual modeling? • Introduction of the Key role players: • Entities • Attributes • Relationships

  3. Why Create a Conceptual Model? • It describes exactly the information needs of the business • It facilitates discussion • It helps to prevent mistakes, misunderstanding • It forms important “ideal system” documentation • It forms a sound basis for physical database design • It is a very good practice with many practitioners

  4. Between Dream and Reality...

  5. Entity Relationship Modeling • Models business,not implementation • Is a well-established technique • Has a robust syntax • Results in easy-to-read diagrams… • ...although they maylook rather complex at first sight

  6. Goals of Entity Relationship Modeling • Capture all required information • Information appears only once • Model no information that is derivable from other information already modeled • Information is in a predictable, logical place

  7. Database Types ER Model Network Hierarchical Relational

  8. Entity • An Entity is: • “Something” of significance to the business about which data must be known • A name for the things that you can list • Usually a noun • Examples: objects, events • Entities have instances

  9. Mahatma Gandhi 2.5 x 35 mm copper nail nail my previous contract violinist fluent tonight: Hamlet in the Royal the CD I bought yesterday for parliament next fall … ... Entities and Instances • PERSON • PRODUCT • PRODUCT TYPE • EMPLOYMENT CONTRACT • JOB • SKILL LEVEL • TICKET RESERVATION • PURCHASE • ELECTION • PRINTER PREFERENCE • DOCUMENT VERSION

  10. manager cook waitress dish washer financial controller porter waiter piano player Entities and Sets • An entity represents a set of instances that are of interest to a particular business. JOB

  11. Attribute • Also represents something of significance to the business • Is a single valued property detail of an entity • Is a specific piece of information that: • Describes • Quantifies • Qualifies • Classifies • Specifies an entity

  12. Entity EMPLOYEE CAR ORDER JOB TRANSACTION EMPLOYMENT CONTRACT Attribute Family Name, Age, Shoe Size, Town of Residence, Email, ... Model, Weight, Catalog Price, … Order Date, Ship Date, … Title, Description, ... Amount, Transaction Date, … Start Date, Salary, ... Attribute Examples

  13. Relationships • Also represent something of significance to the business • Express how entities are mutually related • Always exist between two entities (or one entity twice) • Always have two perspectives • Are named at both ends

  14. Relationship Examples • EMPLOYEES have JOBS • JOBS are held by EMPLOYEES PRODUCTS are classified bya PRODUCT TYPE PRODUCT TYPE is a classification for a PRODUCT PEOPLE make TICKET RESERVATIONS TICKET RESERVATIONS are made by PEOPLE

  15. Employees have Jobs JOB manager EMPLOYEE cook waitress Shintaro dish washer Jill financial controller Adam porter Ahmed waiter Maria piano player Numerical observation: • All EMPLOYEES have a JOB • No EMPLOYEE has more than one JOB • Not all JOBS are held by an EMPLOYEE • Some JOBS are held by more than one EMPLOYEE

  16. EMPLOYEE JOB ELECTION TICKET RESERVATION ORDER JOB ASSIGNMENT Entity Representation in Diagram • Drawn as a “softbox” • Name singular • Name inside • Neither size, nor position has a special meaning During design, entities usually lead to tables.

  17. Attributes in Diagrams Mandatory attribute, that is, known and available for every instance. Optional attribute, that is, unknown or unimportant to know for some instances. EMPLOYEE Family Name Addresso Birth Dateo Shoe Sizeo Email JOB Titleo Description ** * During design, attributes lead to columns.

  18. exactly one has has held by held by one or more Relationship in Diagrams An employee has exactly one job. EMPLOYEE JOB Jobs are held by one or more employees During design, relationships lead to foreign keys.

  19. Two Perspectives optional: mandatory: has JOB EMPLOYEE held by

  20. One Way mandatory: optional: JOB EMPLOYEE has held by Every EMPLOYEE has exactly one JOB

  21. The Other Way mandatory: optional: JOB has EMPLOYEE held by A JOB may be held by one or more EMPLOYEES

  22. P Reading a Relationship End split into Q part of

  23. P Reading a Relationship End split into Q part of

  24. P must be exactly one Q Reading a Relationship End split into Q part of “EachP ” split into may be one or more Qs

  25. P Reading a Relationship End split into Q part of “EachP may be split into one or more Qs”

  26. P Reading a Relationship End split into Q part of “EachP may be split into one or more Qs”

  27. P Reading a Relationship End split into Q part of “EachP may be split into one or more Qs” must be exactly one P “EachQ ” part of may be one or more Ps

  28. P “EachQ must be part of exactly one P” Reading a Relationship End split into Q part of “EachP may be split into one or more Qs”

  29. Functions Drive Data • Business functions are always present. • Explicit • Assumed • Business functions need data. • An entity, attribute, or relationship may be modeled because: • It is used by a business function. • The business need may arise in the near future.

  30. København Bremen Berlin München Weather Forecast January 26 1/-5 3 0/-3 4 3/-1 3 5/-3 3 * * * * Amsterdam 8/3 4 Bruxelles 4/0 2 Paris 4/1 3 Bordeaux 7/2 3

  31. DK København (Copenhagen) IR UK Bremen NL Amsterdam Berlin DE BE Bruxelles (Brussels) LU München Paris (Munich) FR CH Bordeaux IT

  32. Weather Forecast, a Solution CITY* Nameo Geographical Position COUNTRY* Nameo Geographical Position located in having subject of about FORECAST* Dateo Minimum Temperatureo Maximum Temperatureo Wind Force referring to WEATHER TYPE* Icon* Description referred in referring to WIND DIRECTION* Icon* Description referred in

  33. Subtype Unique identifier # # Graphical Elements of ER Diagram Entity Attribute Relationship * * * * o Arc Nontransferability o

  34. Summary • ER Modeling models information conceptually • Based on functional business needs • “What”, not “How” • Diagrams provide easy means of communication • Detailed, but not too much

  35. Practices • Instance or Entity • Guest • Reading • Hotel • Recipe

  36. Practice: Instance or Entity? Concept E/A/I? Example Instance or Entity PRESIDENT ELLA FITZGERALD DOG ANIMAL HEIGHT E CAR A CAR I CAR

  37. Practice: Guest Address Arrival Date Family Name Room Number Floor Number Number of Beds Number of Parking Lots Price TV set available? GUEST HOTEL ROOM

  38. Practice: Reading assigned to EMPLOYEE DEPARTMENT responsible for A Each EMPLOYEE may be assigned to one or more DEPARTMENTS Each DEPARTMENT must be responsible for one or more EMPLOYEES Each EMPLOYEE must be assigned to one or more DEPARTMENTS Each DEPARTMENT may be responsible for one or more EMPLOYEES Each EMPLOYEE must be assigned to exactly one DEPARTMENT Each DEPARTMENT may be responsible for exactly one EMPLOYEE B C

  39. Practice: Read and Comment born in TOWN PERSON birthplace of living in home town of visitor of visited by mayor of with mayor

  40. ROOM* Room Number STAY*Arrival Date PERSON* Name Practice: Hotel HOTEL* Address the lodging for host of with in in guest in of with

  41. Ralph’s Raving Recipes Açorda alentejana Soups bread soup from Portugal vegetarian15 mineasy For 4 persons: 1 onion 4 cloves of garlic1 red pepper1 liter of vegetable broth 4 tablespoons of olive oil 4 fresh eggs1 handful of parsley or coriandersalt, pepper9-12 slices of (old) bread Preparation Cut the onion into small pieces and fry together with the garlic. Wash the red pepper, cut it in half, remove the seeds and fry it for at least 15. page 127

  42. Entities and Attributes in Detail

  43. Overview • Data compared to information • Entities and how to track them down • Attributes • Subtypes and supertypes

  44. Data Compared to Information • Data • Facts given from which other facts may be inferred • Raw material • Example: Telephone Directory • Information • Knowledge, intelligence • Example: Telephone number of florist

  45. Data • Modeling, ConceptualStructuring data concepts into logical, coherent, and mutually related groups • Modeling, PhysicalModeling the structure of the (future) physical database • BaseA set of data, usually in a variety of formats, such as paper and electronically-based • Warehouse A huge set of organized information

More Related