the a lgebra and the calculus

23
The algebra and the calculus …their correspondence and their differences 1

Upload: kedma

Post on 23-Feb-2016

45 views

Category:

Documents


0 download

DESCRIPTION

The a lgebra and the calculus. …their correspondence and their differences. Kifer et all: http:// www.amazon.com / gp /product/0321228383/ref=s9_simh_gw_p14_d1_i3?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SF508JN5HZFRECYND6V&pf_rd_t=101&pf_rd_p=1389517282&pf_rd_i=507846. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The  a lgebra and the  calculus

1

The algebra and the calculus…their correspondence and their differences

Page 2: The  a lgebra and the  calculus

2

Some of this material was taken from

Kifer et all:http://www.amazon.com/gp/product/0321228383/ref=s9_simh_gw_p14_d1_i3?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SF508JN5HZFRECYND6V&pf_rd_t=101&pf_rd_p=1389517282&pf_rd_i=507846

Page 3: The  a lgebra and the  calculus

3A domain is

The set of all allowable values that a function can act on and return a meaningful result.

Page 4: The  a lgebra and the  calculus

4A calculus is

• Any system of calculating• Apparently, the word come from Latin word for rock and

early folks did their counting with piles of rocks. • When we were in high school, it was the mathematics

that deals with the concept of change, like the slope of a curve, as opposed to the slope of a line• Line is delta-y/delta-x• Curve varies in slope depending on where you are in the

curve

Page 5: The  a lgebra and the  calculus

5SQL

• It is a tuple calculus• Variables represent conceptual tuples from a table, derived

table, or singleton• One can also create domain calculi

Page 6: The  a lgebra and the  calculus

6Tuple calculus

Form of query:{T | Condition(T)}

T is the target – a variable that ranges over tuples of valuesCondition is the body of the query

Involves T (and possibly other variables)Evaluates to true or false if a specific tuple is substituted for T

Page 7: The  a lgebra and the  calculus

7Example

{T | Teaching(T) AND T.Semester = ‘F2000’}Is the same as:SELECT *FROM Teaching TWHERE T.Semester = ‘F2000’

Page 8: The  a lgebra and the  calculus

8Domain calculus

• A domain variable is a variable whose value is drawn from the domain of an attribute • Contrast this with a tuple variable, whose value is an entire

tuple• Example: The domain of a domain variable Crs might be

the set of all possible values of the CrsCode attribute in the relation Teaching

Page 9: The  a lgebra and the  calculus

9

Domain calculus expression

{X1 , …, Xn | condition(X1 , …, Xn) }

{Pid, Code | Teaching(Pid, Code, ‘F1997’)}

Page 10: The  a lgebra and the  calculus

10Example

• Algebra: R – S• TRC: {T | R(T) AND NOT S(T)}• DRC: {A,B,C | R(A,B,C) AND NOT S(A,B,C) }

Page 11: The  a lgebra and the  calculus

11

More complete example

Page 12: The  a lgebra and the  calculus

12Another example

Page 13: The  a lgebra and the  calculus

13A visual interface

• Declarative query language, like SQL• Based on DRC (rather than TRC)• Visual

Page 14: The  a lgebra and the  calculus

14

In a more formal form

Page 15: The  a lgebra and the  calculus

15The QBE interface

• Print all professors’ names in the MGT department

Professor Id Name DeptId

P._John MGT

Page 16: The  a lgebra and the  calculus

16

Return all attributes

Professor Id Name DeptId

• MGTP.

Page 17: The  a lgebra and the  calculus

17Joins

Page 18: The  a lgebra and the  calculus

18Condition boxes

Page 19: The  a lgebra and the  calculus

19Insert a tuple

Page 20: The  a lgebra and the  calculus

20A bigger example

Page 21: The  a lgebra and the  calculus

21

Other table based DBs: Microsoft Access

Page 22: The  a lgebra and the  calculus

22Example

Page 23: The  a lgebra and the  calculus

23Filemaker