Presentation is loading. Please wait.

Presentation is loading. Please wait.

Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications C. Faloutsos Relational domain calculus.

Similar presentations


Presentation on theme: "Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications C. Faloutsos Relational domain calculus."— Presentation transcript:

1 Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications C. Faloutsos Relational domain calculus

2 Carnegie Mellon 15-415 - C. Faloutsos2 General Overview relational model Formal query languages –relational algebra –rel. tuple calculus –rel. domain calculus

3 Carnegie Mellon 15-415 - C. Faloutsos3 Overview - detailed rel. tuple calculus –dfn –details –equivalence to rel. algebra rel. domain calculus + QBE

4 Carnegie Mellon 15-415 - C. Faloutsos4 Rel. domain calculus (RDC) Q: why? A: slightly easier than RTC, although equivalent - basis for QBE. idea: domain variables (w/ F.O.L.) - eg: ‘find STUDENT record with ssn=123’

5 Carnegie Mellon 15-415 - C. Faloutsos5 Rel. Dom. Calculus find STUDENT record with ssn=123’

6 Carnegie Mellon 15-415 - C. Faloutsos6 Details Like R.T.C - symbols allowed: quantifiers

7 Carnegie Mellon 15-415 - C. Faloutsos7 Details but: domain (= column) variables, as opposed to tuple variables, eg: ssn name address

8 Carnegie Mellon 15-415 - C. Faloutsos8 Reminder: our Mini-U db

9 Carnegie Mellon 15-415 - C. Faloutsos9 Examples find all student records RTC:

10 Carnegie Mellon 15-415 - C. Faloutsos10 Examples (selection) find student record with ssn=123

11 Carnegie Mellon 15-415 - C. Faloutsos11 Examples (selection) find student record with ssn=123 RTC: or

12 Carnegie Mellon 15-415 - C. Faloutsos12 Examples (projection) find name of student with ssn=123

13 Carnegie Mellon 15-415 - C. Faloutsos13 Examples (projection) find name of student with ssn=123 need to ‘restrict’ “a” RTC:

14 Carnegie Mellon 15-415 - C. Faloutsos14 Examples (projection) find name of student with ssn=123 - RTC:

15 Carnegie Mellon 15-415 - C. Faloutsos15 Examples cont’d (union) get records of both PT and FT students RTC:

16 Carnegie Mellon 15-415 - C. Faloutsos16 Examples cont’d (union) get records of both PT and FT students

17 Carnegie Mellon 15-415 - C. Faloutsos17 Examples difference: find students that are not staff RTC:

18 Carnegie Mellon 15-415 - C. Faloutsos18 Examples difference: find students that are not staff

19 Carnegie Mellon 15-415 - C. Faloutsos19 Cartesian product eg., dog-breeding: MALE x FEMALE gives all possible couples x =

20 Carnegie Mellon 15-415 - C. Faloutsos20 Cartesian product find all the pairs of (male, female) - RTC:

21 Carnegie Mellon 15-415 - C. Faloutsos21 Cartesian product find all the pairs of (male, female) - RDC:

22 Carnegie Mellon 15-415 - C. Faloutsos22 ‘Proof’ of equivalence rel. algebra rel. domain calculus rel. tuple calculus

23 Carnegie Mellon 15-415 - C. Faloutsos23 Overview - detailed rel. domain calculus –why? –details –examples –equivalence with rel. algebra –more examples; ‘safety’ of expressions

24 Carnegie Mellon 15-415 - C. Faloutsos24 More examples join: find names of students taking 15-415

25 Carnegie Mellon 15-415 - C. Faloutsos25 Reminder: our Mini-U db

26 Carnegie Mellon 15-415 - C. Faloutsos26 More examples join: find names of students taking 15-415 - in RTC

27 Carnegie Mellon 15-415 - C. Faloutsos27 More examples join: find names of students taking 15-415 - in RDC

28 Carnegie Mellon 15-415 - C. Faloutsos28 Sneak preview of QBE:

29 Carnegie Mellon 15-415 - C. Faloutsos29 Sneak preview of QBE: very user friendly heavily based on RDC very similar to MS Access interface

30 Carnegie Mellon 15-415 - C. Faloutsos30 More examples 3-way join: find names of students taking a 2-unit course - in RTC: selection projection join

31 Carnegie Mellon 15-415 - C. Faloutsos31 Reminder: our Mini-U db _x.P _x_y 2

32 Carnegie Mellon 15-415 - C. Faloutsos32 More examples 3-way join: find names of students taking a 2-unit course

33 Carnegie Mellon 15-415 - C. Faloutsos33 More examples 3-way join: find names of students taking a 2-unit course

34 Carnegie Mellon 15-415 - C. Faloutsos34 Even more examples: self -joins: find Tom’s grandparent(s)

35 Carnegie Mellon 15-415 - C. Faloutsos35 Even more examples: self -joins: find Tom’s grandparent(s)

36 Carnegie Mellon 15-415 - C. Faloutsos36 Even more examples: self -joins: find Tom’s grandparent(s)

37 Carnegie Mellon 15-415 - C. Faloutsos37 Even more examples: self -joins: find Tom’s grandparent(s)

38 Carnegie Mellon 15-415 - C. Faloutsos38 Hard examples: DIVISION find suppliers that shipped all the ABOMB parts

39 Carnegie Mellon 15-415 - C. Faloutsos39 Hard examples: DIVISION find suppliers that shipped all the ABOMB parts

40 Carnegie Mellon 15-415 - C. Faloutsos40 Hard examples: DIVISION find suppliers that shipped all the ABOMB parts

41 Carnegie Mellon 15-415 - C. Faloutsos41 More on division find students that take all the courses that ssn=123 does (and maybe even more)

42 Carnegie Mellon 15-415 - C. Faloutsos42 More on division find students that take all the courses that ssn=123 does (and maybe even more)

43 Carnegie Mellon 15-415 - C. Faloutsos43 Safety of expressions similar to RTC FORBIDDEN:

44 Carnegie Mellon 15-415 - C. Faloutsos44 Overview - detailed rel. domain calculus + QBE –dfn –details –equivalence to rel. algebra

45 Carnegie Mellon 15-415 - C. Faloutsos45

46 Carnegie Mellon 15-415 - C. Faloutsos46 table


Download ppt "Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications C. Faloutsos Relational domain calculus."

Similar presentations


Ads by Google