DOC PREVIEW
UMD CMSC 424 - Database Design

This preview shows page 1-2-3-23-24-25-26-47-48-49 out of 49 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CMSC424: Database DesignTodayData ModelingEntity-Relationship ModelER Diagram: Starting ExampleRelationship CardinalitiesTypes of AttributesNext: KeysEntity KeysSlide 10Next: Recursive RelationshipsRecursive RelationshipsNext: Weak Entity SetsWeak Entity SetsSlide 15Slide 16Slide 17More…Example DesignSlide 20Slide 21Slide 22Slide 23Thoughts…Slide 25Design IssuesRecapRelational Data ModelKey Abstraction: RelationWhy Called Relations?RelationsSlide 32DefinitionsSo…Keys and RelationsKeysSlide 37Slide 38More on KeysSchema Diagram for the Banking EnterpriseExtra slides…Next: Data ConstraintsParticipation ConstraintSlide 44Cardinality ConstraintsNext: SpecializationFinally: AggregationSlide 48Slide 49CMSC424: Database DesignInstructor: Amol Deshpande [email protected]Next class, homework etc..E/R ModelRelational ModelData ModelingGoals:Conceptual representation of the data“Reality” meets “bits and bytes”Must make sense, and be usable by other peopleEnd result should capture all the domain knowledgeEntity-Relationship ModelTwo key conceptsEntities:An object that exists and is distinguishable from other objectsExamples: Bob Smith, BofA, CMSC424Form entity sets with other entities of the same typeRelationships:Relate 2 or more entities E.g. Bob Smith has account at College Park BranchForm relationship sets with other relationships of the same type that share the same properties5ER Diagram: Starting ExampleRectangles: entity setsDiamonds: relationship setsEllipses: attributescustomerhascust-streetcust-idcust-namecust-cityaccountbalancenumberaccess-dateRelationship CardinalitiesOne-to-OneOne-to-ManyMany-to-OneMany-to-ManycustomerhasaccountcustomerhasaccountcustomerhasaccountcustomerhasaccountTypes of Attributescustomercust-streetcust-idcust-namecust-cityhasaccountbalancenumberaccess-datephone no.date-of-birthagemonthday yearComposite AttributeNext: KeysKey = set of attributes that uniquely identifies an entity or a relationshipcustomercust-streetcust-idcust-namecust-cityphone no.agedate-of-birthPossible Keys: {cust-id} {cust-name, cust-city, cust-street} {cust-id, age} cust-name ?? Probably not.Domain knowledge dependent !!Entity KeysEntity KeysSuperkeyany attribute set that can distinguish entitiesCandidate keya minimal superkeyCan’t remove any attribute and preserve key-ness{cust-id, age} not a candidate key {cust-name, cust-city, cust-street} is assuming cust-name is not uniquePrimary keyCandidate key chosen as the key by DBAUnderlined in the ER DiagramNext: Recursive RelationshipsSometimes a relationship associates an entity set to itselfRecursive Relationships Must be declared with rolesemployeeworks-foremp-streetemp-idemp-nameemp-citymanagerworkerNext: Weak Entity SetsAn entity set without enough attributes to have a primary keyE.g. Transaction EntityAttributes:transaction-number, transaction-date, transaction-amount, transaction-typetransaction-number: may not be unique across accountsWeak Entity SetsA weak entity set must be associated with an identifying or owner entity setAccount is the owner entity set for TransactionWeak Entity SetsaccountbalancenumberTransactionhastrans-typetrans-numbertrans-datetrans-amt Still need to be able to distinguish between different weak entities associated with the same strong entityWeak Entity SetsaccountbalancenumberTransactionhastrans-typetrans-numbertrans-datetrans-amt Discriminator: A set of attributes that can be used for thatWeak Entity SetsPrimary key:Primary key of the associated strong entity + discriminator attribute setFor Transaction:{account-number, transaction-number}More…Read Chapter 6 for:Semantic data constraintsSpecialization/Generalization/AggregationGeneralization: opposite of specializationLower- and higher-level entitiesAttribute inheritanceHomework 1 !!Example DesignWe will model a university databaseMain entities:ProfessorProjectsDepartmentsGraduate studentsetc…professorareanameSSNrankprojectstartsponsorproj-numberbudgetdeptofficenamedept-nohomepagegradagenameSSN degreeprofessorareanameSSNrankprojectstartsponsorproj-numberbudgetdeptofficenamedept-nohomepagegradagenameSSN degreePICo-PIRAMajorChairSupervisesMentoradviseeadvisorApptTime (%)professorareanameSSNrankprojectstartsponsorproj-numberbudgetdeptofficenamedept-nohomepagegradagenameSSN degreePICo-PIRAMajorChairApptSupervisesMentoradviseeadvisorTime (%)professorareanameSSNrankprojectstartsponsorproj-numberbudgetdeptofficenamedept-nohomepagegradagenameSSN degreePICo-PIRAMajorChairApptSupervisesMentoradviseeadvisorTime (%)And so on…Thoughts…Nothing about actual dataHow is it stored ? No talk about the query languagesHow do we access the data ?Semantic vs Syntactic Data ModelsRemember: E/R Model is used for conceptual modelingMany conceptual models have the same propertiesThey are much more about representing the knowledge than about database storage/queryingThoughts…Basic design principlesFaithfulMust make senseSatisfies the application requirementsModels the requisite domain knowledgeIf not modeled, lost afterwardsAvoid redundancyPotential for inconsistenciesGo for simplicityTypically an iterative process that goes back and forthDesign IssuesEntity sets vs attributesDepends on the semantics of the applicationConsider telephoneEntity sets vs Relationsihp setsConsider loanN-ary vs binary relationshipsPossible to avoid n-ary relationships, but there are some cases where it is advantageous to use themIt is not an exact science !!RecapEntity-relationship ModelIntuitive diagram-based representation of domain knowledge, data properties etc…Two key concepts:EntitiesRelationshipsWe also looked at:Relationship cardinalitiesKeysWeak entity sets…• Before = “Network Data Model” (Cobol as DDL, DML)• Very contentious: Database Wars (Charlie Bachman vs. Mike Stonebraker)Introduced by Ted Codd (late 60’s – early 70’s)1. Separation of logical, physical data models (data independence)2. Declarative query languages3. Formal semantics4. Query optimization (key to commercial success)Relational data model contributes:• Ingres  CA • Postgres  Illustra  Informix  IBM• System R  Oracle, DB21st prototypes:Relational Data


View Full Document

UMD CMSC 424 - Database Design

Documents in this Course
Lecture 2

Lecture 2

36 pages

Databases

Databases

44 pages

Load more
Download Database Design
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Database Design and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Database Design 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?