




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、Database DesignApril 3, 20021Projects, More DetailsGoal: build a DB application.(almost) anything goes.Groups of 3-4.End of week 2: groups formed.End of week 3: proposals, E/R diagramsEnd of week 5: project specs dueEnd of week 7: sample end-to-end app dueJune 7th: demos2Building an Application with
2、 a DBMSRequirements modeling (conceptual, pictures)Decide what entities should be part of the application and how they should be linked.Schema design and implementationDecide on a set of tables, attributes.Define the tables in the database system.Populate database (insert tuples).Write application p
3、rograms using the DBMSway easier now that the data management is taken care of.3OutlineODL - Object Definition Language (2.1)E/R - Entity relationship diagrams (2.2)Design Principles (2.3)4Database DesignWhy do we need it? Agree on structure of the database before deciding on a particular implementa
4、tion.Consider issues such as:What entities to modelHow entities are relatedWhat constraints exist in the domainHow to achieve good designs5Database Design Formalisms1. Object Definition Language (ODL): Closer in spirit to object-oriented models2. Entity/Relationship model (E/R):More relational in na
5、ture.Both can be translated (semi-automatically) to relational schemas ODL to OO-schema: direct transformation (C+ or Smalltalk based system).61. Object Definition LanguageODL is part of ODMGsuperset of Corbas IDL Resembles C+ (and Smalltalk).7ODL PrinciplesBasic design paradigm in ODL: Model object
6、s and their properties.For abstraction purposes:Group objects into classes.What qualifies as a good class?Objects should have common properties.8ODL Class DeclarationsClass declaration:Methods: arbitrary function, of little concern for us hereInterface attributes: ; relationships ; methods (param)9O
7、DL ExampleProductPersonCompanycategorynamepricenamestockpricenameaddressssn10ODL DeclarationsInterface Product attribute string name; attribute float price; attribute enum Categories electronics, communications, sports category Interface Company attribute string name; attribute float stockprice; Int
8、erface Person attribute integer ssn; attribute string name; attribute struct Address string street, string city address; So far just simplified C+ with slightly different syntax11ODL Example ExtendedProductPersonCompanycategorynamepricenamestockpricenameaddressssnbuysworksFormadeBy12ODL Declarations
9、, ExtendedInterface Product attribute string name; attribute float price; attribute enum Categories electronics, communications, sports category; relationship madeBy; Interface Person attribute integer ssn; attribute string name; attribute Struct Address string street, string city address; relations
10、hip set buys; relationship set worksFor;relationship corresponds somewhat to pointers in C+13ODL Example, Extended AgainProductPersonCompanycategorynamepricenamestockpricenameaddressssnbuysworksFormadeByemploysmakes14ODL Declarations, Extended AgainInterface Company attribute string name; attribute
11、float stockprice; relationship set makes inverse Product:madeBy; relationship set employs inverse Person:worksFor; 15Types in ODLBasic types: Atomic types (e.g., string, integer, ) Interface types (e.g., Person, Product, Company)Constructors:collection types: Set: 1, 5, 6 Bag: 1, 1, 5, 6, 6 List: 1,
12、 5, 6, 1, 6 Array: integer17structured types: Struct string street, string city, integer zipcode16Collection TypesSets:order, number of occurrences dont matter4,7,9 = 7,9,7,4 = 9,4,7Bags:number of occurrences matter, order not:7,9,7,4=7,7,9,4, is different from 4,7,9Lists:order, number of occurrence
13、s matter:4,7,9 different from 9,4,717Allowable Types in ODLFor attributes: atomic/struct, or collection of atomic/struct OK: string, set Not OK: Product, setsetFor relationships: interface, or collection of interface. OK: Product, set, list Not OK: struct pname Product, cname Company setbag integer1
14、82. Entity / Relationship DiagramsObjects entitiesClasses entity setsAttributes are like in ODL.Relationships: like in ODL except - first class citizens (not associated with classes) - not necessarily binaryProductaddressbuys19addressnamessnPersonbuysmakesemploysCompanyProductnamecategorystockpricen
15、ameprice20What is a Relation ?A mathematical definition:if A, B are sets, then a relation R is a subset of A x BA=1,2,3, B=a,b,c,d, R = (1,a), (1,c), (3,b)- makes is a subset of Product x Company:123abcdA=B=makesCompanyProduct21Multiplicity of E/R Relationsone-one:many-onemany-many123abcd123abcd123a
16、bcd22Multi-way RelationshipsHow do we model a purchase relationship between buyers,products and stores?PurchaseProductPersonStoreCan still model as a mathematical set (how ?)23Q: what does the arrow mean ?A: if I know the store, person, invoice, I know the movie tooRentalVideoStorePersonMovieInvoice
17、Arrows in Multiway Relationships24Q: what do these arrow mean ?A: store, person, invoice determines movie and store, invoice, movie determines personRentalVideoStorePersonMovieInvoiceArrows in Multiway Relationships25Q: how do I say: “invoice determines store” ?A: no good way; best approximation:Q:
18、Why is this incomplete ?RentalVideoStorePersonMovieInvoiceArrows in Multiway Relationships26Roles in RelationshipsPurchaseWhat if we need an entity set twice in one relationship?ProductPersonStoresalespersonbuyer27Attributes on RelationshipsPurchaseProductPersonStoredate28Converting Multi-way Relationships to BinaryPurchasePersonStoreProductStoreOfProductOfBuyerOfdate293. Design PrinciplesPurchaseProductPerso
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 智慧辦公樓宇智能化管理系統研究
- 兒童呼吸健康教育的教育資源配置優化
- 教育平臺如何助力全球學習者實現無縫交流與學習
- 數字化教育技術培訓打造高效學習環境
- 醫學實驗室的科技先鋒毛細管電泳儀的醫療價值探討
- 教育公平與教育質量的雙重挑戰
- 醫療培訓中的公平與質量協同發展
- 商業培訓中的學習風格識別與優化策略
- 抖音商戶客服退換貨處理效率制度
- 全球鈾礦資源分布與核能產業技術創新與產業發展研究報告
- (完整版)新課標人教版小學英語單詞表匯總
- ctcs-3級列控系統概述課件
- 2022年汕頭澄海區教師招聘考試真題
- 考研題土力學
- 雙向拉伸聚酯薄膜生產知識
- 綠山墻的安妮-練習答案(完整版)資料
- 2022年小學美術教師進城(選調)招聘考試模擬試題(共五套)
- 貴陽小升初分班全真模擬測A卷
- GB/T 77-2007內六角平端緊定螺釘
- 中華人民共和國安全生產法
- 九年一貫制學校教育教學管理制度匯編
評論
0/150
提交評論