Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications

Download Presentation

Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications

Loading in 2 Seconds...

- 60 Views
- Uploaded on
- Presentation posted in: General

Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Carnegie Mellon Univ.Dept. of Computer Science15-415 - Database Applications

C. Faloutsos

Relational domain calculus

- relational model
- Formal query languages
- relational algebra
- rel. tuple calculus
- rel. domain calculus

15-415 - C. Faloutsos

- rel. tuple calculus
- dfn
- details
- equivalence to rel. algebra

- rel. domain calculus + QBE

15-415 - C. Faloutsos

- 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’

15-415 - C. Faloutsos

- find STUDENT record with ssn=123’

15-415 - C. Faloutsos

- Like R.T.C - symbols allowed:
- quantifiers

15-415 - C. Faloutsos

- but: domain (= column) variables, as opposed to tuple variables, eg:

ssn

address

name

15-415 - C. Faloutsos

15-415 - C. Faloutsos

- find all student records

RTC:

15-415 - C. Faloutsos

- (selection) find student record with ssn=123

15-415 - C. Faloutsos

- (selection) find student record with ssn=123

or

RTC:

15-415 - C. Faloutsos

- (projection) find name of student with ssn=123

15-415 - C. Faloutsos

- (projection) find name of student with ssn=123

need to ‘restrict’ “a”

RTC:

15-415 - C. Faloutsos

- (union) get records of both PT and FT students

RTC:

15-415 - C. Faloutsos

- (union) get records of both PT and FT students

15-415 - C. Faloutsos

- difference: find students that are not staff

RTC:

15-415 - C. Faloutsos

- difference: find students that are not staff

15-415 - C. Faloutsos

- eg., dog-breeding: MALE x FEMALE
- gives all possible couples

=

x

15-415 - C. Faloutsos

- find all the pairs of (male, female) - RTC:

15-415 - C. Faloutsos

- find all the pairs of (male, female) - RDC:

15-415 - C. Faloutsos

- rel. algebra <-> rel. domain calculus
<-> rel. tuple calculus

15-415 - C. Faloutsos

- rel. domain calculus
- why?
- details
- examples
- equivalence with rel. algebra
- more examples; ‘safety’ of expressions

15-415 - C. Faloutsos

- join: find names of students taking 15-415

15-415 - C. Faloutsos

15-415 - C. Faloutsos

- join: find names of students taking 15-415 - in RTC

15-415 - C. Faloutsos

- join: find names of students taking 15-415 - in RDC

15-415 - C. Faloutsos

15-415 - C. Faloutsos

- very user friendly
- heavily based on RDC
- very similar to MS Access interface

15-415 - C. Faloutsos

- 3-way join: find names of students taking a 2-unit course - in RTC:

join

projection

selection

15-415 - C. Faloutsos

_x

.P

_y

2

_x

_y

15-415 - C. Faloutsos

- 3-way join: find names of students taking a 2-unit course

15-415 - C. Faloutsos

- 3-way join: find names of students taking a 2-unit course

15-415 - C. Faloutsos

- self -joins: find Tom’s grandparent(s)

15-415 - C. Faloutsos

- self -joins: find Tom’s grandparent(s)

15-415 - C. Faloutsos

- self -joins: find Tom’s grandparent(s)

15-415 - C. Faloutsos

- self -joins: find Tom’s grandparent(s)

15-415 - C. Faloutsos

- find suppliers that shipped all the ABOMB parts

15-415 - C. Faloutsos

- find suppliers that shipped all the ABOMB parts

15-415 - C. Faloutsos

- find suppliers that shipped all the ABOMB parts

15-415 - C. Faloutsos

- find students that take all the courses that ssn=123 does (and maybe even more)

15-415 - C. Faloutsos

- find students that take all the courses that ssn=123 does (and maybe even more)

15-415 - C. Faloutsos

- similar to RTC
- FORBIDDEN:

15-415 - C. Faloutsos

- rel. domain calculus + QBE
- dfn
- details
- equivalence to rel. algebra

15-415 - C. Faloutsos