Está en la página 1de 45
Data Modeling Using Oracle (Barker Notations) cotinera@itu.edu.tr Asioe Prof Dr.B Gilickin Got DATA MODELING Entity Definition and Relations Defining Attributes and Unique Identifiers + Normalizing Data Model * Understanding Advanced Relations + Transform Data Model to Database (Designing Database from Data Model) cetinerg@itu.edutr Asso: Prof De I4O ltekin Cetire} * Defining Entities * Understanding Relations cotinera@itu.edu.tr Defining Emities Defining Entities cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} v Defining Entities + Starting pointin developing 2 good data model in goodset of data requirements. ‘These requirements might be | informsof * interviow notes, rerhal conversations with the user and, © formal requirements specification document (RSD). cetinera@itu.edu.tr Assoc Prof Dr. G lickin Getine} Defining Emities * These requirements may include information about just data, or about the data and the business functions * which use this data, * Functions required to be implemented in a business without regarding the knowledge of how to do it. cetinera@itu.edu.tr Asse Prof Dr HG thekin Cetin} Defining Entities + First step is to digest information and then to find the entities* about which the business needs to store data. ely FAS * Entity: A thing of significance, whether concrete or abstract, about which information needs to beknown or held. cotinero@itu ecu Assoc Prof De.8 ilehin Cette} Defining Entities ‘+ What is an entity? Some definitions are as follows: cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} Defining Entities + An entity isa thing of significance about which information needs to be stored. In other words, an entity is something important enough to your organizationso the organizations willing to spend money to keep records about it: CUSTOMERs, EMPLOYEES etc. cetinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Defining Emities + An entity isa class or category of thing. A single employce is not an entity, but the general category EMPLOYEE isan entity. cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} w Defining Entities + An entity isa named thing. Tt may be a tangible thing, suchas a TRUCK, ora concept, such as a COST CENTER. Assoe Prof Dr.B Gilickin Getine} cotinera@itu.edu.tr Defining Emiities Entity Examples We have already seen some examples of entities, ‘Some more examples are as follows: TRUCK a Asso: Prof DrI4G ltekin Cetin} cotinergitu.edu.tr Defining Entities Entity Examples We have already seen some examples of entities, ‘Some more examples are as follo BANK ACCOUNT cetinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Defining Emities Entity Examples We have already seen some examples of entities, ‘Some more examples are as follows :~ PROJECT [ezassazere ] cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} Defining Entities Entity Examples We huye already seen some examples of entities, ‘Some more examples are as follows:- CONTRACTOR cotinera@itu.edu.tr Assoc ProfDr 186 illekin Get Defining Entities Entity Examples We have already seen some examples of entities, ‘Some more examples are as follows :~ PART cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} Defining Entities Entity Examples We have already seen some examples of entities, ‘Some more examples are as follo INSURANCE POLICY cotinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Defining Emities Entity Examples We have already seen some examples of entities, ‘Some more examples are as follows :~ DEFENDANT cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} Defining Entities Entity Examples We have already seen some examples of entities, ‘Some more examples are as follows: CUSTOMER cetinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Defining Emities Diagramming Entities Entities are drawn in diagram as soon as they are identified. cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} 10 Defining Entities For now, we just draw boxes to represent entities. Youean choose some conventions for drawing entities on E-R Diagrams, * Boxes are soft, 1.e. with rounded corners. For example; jn |e ORDER SS cotinera@itu.edu.tr Assoc ProfDr 186 illekin Get Understanding Relations Beginning Identify Relationships Relationship Sentences Relationship Names Optionality in Relationships Relationship Degree Diagramming Relationships Relationship Types Validating Relationships cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} Understanding Relations Relationship Sentences Even though the E-R Diagramconsists of boxes and lines Just a few words, you as the analyst should be able to “read” it to either a technical Database Administrator or a non- technical business person. E-R Diagrams are essential for communicating data requirements in business. cotinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations ‘The key to make your E-R Diagram “readable” is the Relationship Sentence. It is a complete sentence and can be constructed in any language. ii cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} Understanding Relations ‘Suppose you have two entitles: CUSTOMER and ORDER. ‘We can describe how customers and orders are related with two sentences: “Each CUSTOMER may be the originator of one or more ORDERS.” “Each ORDER must be placed by one and only one CUSTOMER” cetinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations Let's divide one of these sentences. “Each ORDER must he placed by one and only one CUSTOMER” ‘The formal syntax of the sentence is: (must be} {fone or more} Fach ENTITY or pane or ENTITY? Aenay be) (one and onty one} a SEE So, ORDER and CUSTOMER are the entities, and “placed by” is the name of the relationship. cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} 13 Understanding Relations ‘The statement “must be” or “may be” describes whether the relationship is mandatory or optional. ‘The statement “one or more” or “one and only one” describes the cardinality (degree) of relationship. —_, [must be} tome or mare} Pah ENTITY! or arme or ENT? {may be) {ome aed onty one} ——E——— ‘We will look at each of these parts of the sentence in detail. cetinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations Let’s look at the following sentence: “Each ORDER must he made hy one and only one (CUSTOMEI ‘The choice of term “must be” indicates that an order cannot exist without a customer to place it. This relationship is mandatory, If there is ORDER then there must he CUSTOMER who made. cotinergitu.edu.tr Asso: Prof DrI4G ltekin Cetin} 14 Understanding Relations Let’s look at the other half of the relationship sentence. “Each CUSTOMER may be the originator of one or more ORDERS” ‘The choice of the term “may he” indicates that a customer may exist in our datahase without ever placing an order. Think of a CUSTOMER who has heen sent a CATALOG but never bought anything yet. cetinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations Is the relationship mandatory or optional? “EachEMPLOYEE ___ assignedto one and only one DEPARTMENT? 1B. may be cotinergitu.edu.tr Asso: Prof DrI4G ltekin Cetin} Understanding Relations Is the relationship mandatory oF optional? Choose “must be” or “may be” “Each PROJECT carried out by one or more EMPLOYEEs” A. must be cetinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations Is the relationship mandatory or optional? Choose “must he” or “may be" “Fach RESERVATION made by one and only one EMPLOYER” B. may be. cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} 16 Understanding Relations Relationship Degree Now let’s look at the other end of the Relationship Sentences; “Each ORDER must be made by one and only one CUSTOMER.” “Each CUSTOMER may be the originator of one or more ORDERs.” cotinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations ‘The degree of relationship is stated as either“one and only one” or “one or more. The “one sind only one” is known as 2 “single-valued” relationship. ch ORDER must be made by one and only one ISTOMER”” cetinera@itu.edu.tr Asso: Prof DrI4G ltekin Cetin} Understanding Relations “One or more” means “one, orany number”, “One or more” usually used in optional relations. “One or more” allows the CUSTOMER to place one ORDER, a hundred or a thousand. The CUSTOMER may also bein database with zero orders. ‘This relationis called “many -valued retationshi, “Each CUSTOMER may he the originator of one or more. ORDERS” cotinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations Choose the relationship degree using one of the options. “Each ORDER must be made up of 1TEMs” ORDER LINE A. “one and only one” B, “hetween one and twelve” [C “one or more” “any number except zero” cotinergitu.edu.tr Asso: Prof DrI4G ltekin Cetin} Understanding Relations Choose the relationship degree using one of the options. “Each ORDER LI ORDER” B, “one or more” C. “zero, or one or more” 1D. “none of the above” ITEM must be contained in cotinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations Diagramming Relationships Now it is time to represent all these in an E-R Diagram, ‘This diagram indicates how relationship names, optionality and degree are Indicated. Relationship TS l nae a Relationship SS name catinergG@itu ecu Assoc Prof Dr. Gilckin Gat Understanding Relations Each half of the line is elther dashed (mm = == ) to indicate an optional relationship, or solid (———— to indicate a mandatory one. Mandatory Relationship Optional Relationship (mutt be) (may be) l $< cotinera@itu.edu.tr Assoc ProfDr 186 illekin Get Understanding Relations ‘The “crow’s foot” indicates “one or more” or “multi-valued” condition. If there is not a crow’s foot then the relationship degree is “one and only ‘Multi-valued condition ‘one and only one —— [ — } name’ cetinera@itu.edu.tr Assoc Prof Dr 18G tin Cetin 20 Understanding Relations “Each ORDER must be made by one and only one CUSTOMER” sentence is mandatory and single-valued. Therefore, we draw a solid line from ORDER to CUSTOMER and write the relation name as made by. Absence of crow-foot shows single-valued relation. (Ga) made by a [ ORDER _ {arom — ——S cotinera@itu.edu.tr Assoe Prof Dr.B Gilickin Getine} Understanding Relations Read the sentence in the following order; Fach ORDER must he made by ‘one and only one CUSTOMER 1 2 3 « = made by ORDER "aes —$——S —$——

También podría gustarte