12.07.2015 Views

2 Conceptual Database Design Database Design:Terminology 2.1.2 ...

2 Conceptual Database Design Database Design:Terminology 2.1.2 ...

2 Conceptual Database Design Database Design:Terminology 2.1.2 ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CREATE TABLE Studentin(SID INTEGER PRIMARY KEY,VName CHAR(20)Name CHAR(30) CREATE NOT NULL, TABLE KursEmail Char(40)); (KID CHAR(10) PRIMARY KEY,Name CHAR(40) NOT NULL,Dauer INTEGER);2 <strong>Conceptual</strong> <strong>Database</strong> <strong>Design</strong>2.1 Requirement analysis2.2 Modeling languages2.1.1. Overview LifecycleRequirement analysis-> Text2.1.1 Overview<strong>2.1.2</strong> Requirement Analysis (case study)2.2.1 Basic Modeling Primitives2.2.2 Modeling Languages: UML andEntity-Relationship Model (ERM)2.2.3 <strong>Conceptual</strong> DB design: basics2.2.4 From Requirements to Models<strong>Conceptual</strong> <strong>Design</strong>Logical Schema <strong>Design</strong>Physical Schema <strong>Design</strong>-> <strong>Conceptual</strong> Model-> <strong>Database</strong> schema-> Access pathsCREATE TABLE OrderODate DATEsoldBy INTEGER FOREIGN KEYREFEREBCES Peronal(PID)CID INTEGER FOREIGNKEY REFERENCES Customer (CID));References: Kemper / Eickler chap 2, Elmasri / Navathe chap. 3Garcia-Molina / Ullmann / Widom: chap. 2Administration© HS-2009Redesign02-DBS-<strong>Conceptual</strong>-2<strong>Database</strong> <strong>Design</strong>:<strong>Terminology</strong>Def.: <strong>Database</strong> <strong>Design</strong>The process of defining the overall structure of a database,i.e. the schema, on different layers of abstraction.<strong>Design</strong> levels: <strong>Conceptual</strong>, logical, physicalIncludes "Analysis" and "<strong>Design</strong>" from SEDB Modeling: defining the "static model" using formal or visuallanguagesDBRequirements<strong>Conceptual</strong> modelingLogical modelingPhysical modelingSERequirementsAnalysis<strong>Design</strong>Implementation<strong>2.1.2</strong> Requirement AnalysisMost important: talk with your customers!Tasks during RA:• Identify essential "real world" information (e.g.interviews)• Remove redundant, unimportant details• Clarify unclear natural language statements• Fill remaining gaps in discussions• Distinguish data and operationsRequirement analysis & <strong>Conceptual</strong> <strong>Design</strong> aims atfocusing thoughts and discussions !© HS-200902-DBS-<strong>Conceptual</strong>-3© HS-200902-DBS-<strong>Conceptual</strong>-4Example: Geo-DBRequirement AnalysisThe database we develop will contain data about countries, cities,organizations and geographical facts. In the first step, countries, cities,regions (like "Bundesländer" or geographical regions), and continentsare to be represented in the DB.In the requirements analysis it has to be clarified, what kind ofinformation is supposed to be represented, not how it should berepresented!First step: filter essential information , ignore unimportantdetailsNote: importance of some piece of informationdepends on the application scenario• Clarify unclear statements• what is a country?Political unit: compare Korea vs South /North Korea• Fill gap• Cities are located in regions. What ifa country does not have regions?→ region is country itself• Can a region belong to different countries? No, butthere may be regions with the same name in different countries• Can a country belong to different continents? Yes.• Distinguish data from operations• Gross National Product per inhabitant: calculate• "It happens that countries are united" ....© HS-200902-DBS-<strong>Conceptual</strong>-5© HS-200902-DBS-<strong>Conceptual</strong>-61


2.2.1 Basic modeling primitives<strong>Conceptual</strong> modeling• Distinguish between types (classes) and individualfacts (metadata vs data)• The name of this woman is Kunz with first name Tamara.• As opposed to:• A person is identified by first name, last name and birth date.• Describe reality on a type level• Use a graphical language in order to get an overallimpression of the domain modeled.Modeling language requirements• What is the right language for "modeling reality"?• Which language primitives ?•An old problem of philosophy: how to describe theworld in an appropriate, comprehensible way?One of the answers were logic languages.They allow to express more than we (currently) want to:facts and rules.e.g.: human(Plato) , ∀x (human(x) ⇒ mortal(x)© HS-200902-DBS-<strong>Conceptual</strong>-7© HS-200902-DBS-<strong>Conceptual</strong>-8Basic modeling primitivesBasic modeling primitivesModeling the "Real World"Entity (type)something which exists, has a name•Attribute• property of an entityRelationshipconnects two or more entities"Non sunt multiplicanda entia praeter necessitatem"William van Ockham, English philosopher, 13th century(Principle of Economy, Law of Parsimony)© HS-2009CountrynameinhabitCityCitypopulatnameencom_passes02-DBS-<strong>Conceptual</strong>-9CountryCountrynameGNPpopulatContinentnameareapopulation?Issues• <strong>Design</strong> choicesattribute or entity?continent: attribute of country or separate entity?© HS-2009There is never exactly one way of modeling reality.Many good designs, much more bad designs.• Identification• e.g. name obviously identifies continents but not cities• Identifying attributes needed at all?02-DBS-<strong>Conceptual</strong>-102.2.2 Modeling notations and languagesEntity-Relationship-Model (ERM)• data-oriented: static modeling of data• 1976 introduced by P.P. Chen• (Peter P. Chen: The Entity-Relationship Model - Toward a Unified View ofData. ACM TODS 1(1): 9-36, 1976, see Reader)Traditional graphical notation with squares, bullets and diamondTitleLIDhoursStudentattendLectureNameFNameMatr-NrEmailGraphical modeling languagesUnified modeling language (UML)Modeling of data and operations• Object oriented flavore.g: each object (entity) has identity - a unique pointerERM: entities having the same type andthe same attribute values are indistinguishable• Attributes may be constructed (lists, sets, arrays,…)• Relationships are directed (uni- or bidirectional)ERM: always bidirectional© HS-200902-DBS-<strong>Conceptual</strong>-11© HS-200902-DBS-<strong>Conceptual</strong>-122


UML versus ERM2.2.3 <strong>Conceptual</strong> <strong>Design</strong>: BasicsUMLERMTitleLIDhoursStudentMatr-NrNameFName{Email}register(Lect x)attendStudentattendLectureLectureLIDTitleHoursassignRoom(R r)NameFNameMatr-NrEmailCalled associationin UML, may bedirectedOperations on dataWe basically usesimplified UML notationEntities & attributesentity nameattribute listNo methods…{}multivalued attributeexample: first namefor entity Person© HS-200902-DBS-<strong>Conceptual</strong>-13© HS-200902-DBS-<strong>Conceptual</strong>-14Basics<strong>Conceptual</strong> <strong>Design</strong>: BasicsIdentifying attributes• "Axiom" of Relational DB:Two individual entities can always be distinguishedby the values of some of its attribute(s), togethercalled the keyKey attributes areunderlinedor annotated byPerson namebirthDatefirstName{phones}Note: one single attribute may notbe identifying for an entity.> : UML Stereotype, allows to extend UML – here primarykey attributesAlternative notation: underline all PK attributes (which we use)Relationships…relates_to…• Always have a name• No direction• May have attributes• No identifying attributes…Example:buysCustomerquantityProduct© HS-200902-DBS-<strong>Conceptual</strong>-15© HS-200902-DBS-<strong>Conceptual</strong>-16Modeling basics<strong>Conceptual</strong> <strong>Design</strong>: UMLWeak entityaccountaccNumbernameacc_typebalance…hasaccTransactions_numberdayvalue //+ or -…Example: account statement identified by "number" and "acc_number"which is not attribute of 'statement' entity (!)Def:: A weak entity is an entity identified by some ofits attributes and the relationship to another entity .Notation !UML-<strong>Terminology</strong>• Class = entity type (UML: attribute = field)• Object = entity• Association = relationship• NO keys: objects are identified by unique address• Relationship may have a direction…relates_to……© HS-200902-DBS-<strong>Conceptual</strong>-17© HS-200902-DBS-<strong>Conceptual</strong>-183

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!