Download presentation

Presentation is loading. Please wait.

Published byDrake Annable Modified over 3 years ago

1
6.830 / 6.814 Lecture 2 Data Models Sam Madden 9.8.2014 “Those who cannot remember the past are doomed to repeat it”

2
Modified Zoo Data Model Slightly different than last time: Each animal in 1 cage, multiple animals share a cage Each animal cared for by 1 keeper, keepers care for multiple animals

3
Example IMS Hierarchy Jane (keeper) (HSK 1) Sam, salamander, … (2) 1, 100sq ft, …(3) Mike, giraffe, … (4) 2, 1000sq ft, … (5) Sally, student, … (6) 1, 100sq ft, … (7) Joe (keeper) (8) Keepers segment A1 Segment A2 SegmentA3 Segment C1 SegmentC2 SegmentC3 Segment

4
Example IMS Programs Find the cages that Jane keeps GetUnique(Keepers, name = "Jane") Until done: cageid = GetNextPredicate (cages).no print cageid

5
Example IMS Programs Find the keepers that keep cage 6 GetUnique(keepers) GetNextPredicate(cages, id = 6) Until done: GetNext(keepers) GetNextPredicate(cages, id = 6)

6
Study break #1 Consider a course schema with students, classes, rooms (each has a number of attributes) Classes in exactly one room Students in zero or more classes Classes taken by zero or more students Rooms host zero or more classes Classes Students Rooms isin takenby

7
Questions 1.Describe one possible hierarchical schema for this data 2.Is there a hierarchical representation that is free of redundancy? 3.What problems might this redundancy lead to? Classes Students Rooms isin takenby

8
Example CODASYL Hierarchy

9
Example CODASYL Program Find the cages that Joe keeps Find keepers (name = 'Joe') Until done: Find next animal in caredforby Find cage in livesin

10
Study Break # 2 Schema: classes: (cid, c_name, c_rid, …) rooms: (rid, bldg, …) students: (sid, s_name, …) takes: (t_sid, t_cid) SELECT s_name FROM student,takes,classes WHERE t_sid=sid AND t_cid=cid AND c_name=‘6.830’

11
Questions Write an equivalent relational algebra expression for this query Are there other possible expressions? Do you think one would be more “efficient” to execute? Why? SELECT s_name FROM student,takes,classes WHERE t_sid=sid AND t_cid=cid AND c_name=‘6.830’

Similar presentations

OK

1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra) Query Formulation Exercise.

1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra) Query Formulation Exercise.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on tool condition monitoring Ppt on decimals for class 7 Ppt on healthy food and junk food Ppt on tunnel diode Tissue anatomy and physiology ppt on cells Ppt on statistics in maths what does product Ppt on nature and human mix Download ppt on work life and leisure Ppt on dry cell and wet cell battery Ppt on bond length formula