the a lgebra and the calculus
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 PresentationTRANSCRIPT
1
The algebra and the calculus…their correspondence and their differences
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
3A domain is
The set of all allowable values that a function can act on and return a meaningful result.
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
5SQL
• It is a tuple calculus• Variables represent conceptual tuples from a table, derived
table, or singleton• One can also create domain calculi
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
7Example
{T | Teaching(T) AND T.Semester = ‘F2000’}Is the same as:SELECT *FROM Teaching TWHERE T.Semester = ‘F2000’
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
9
Domain calculus expression
{X1 , …, Xn | condition(X1 , …, Xn) }
{Pid, Code | Teaching(Pid, Code, ‘F1997’)}
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) }
11
More complete example
12Another example
13A visual interface
• Declarative query language, like SQL• Based on DRC (rather than TRC)• Visual
14
In a more formal form
15The QBE interface
• Print all professors’ names in the MGT department
Professor Id Name DeptId
P._John MGT
16
Return all attributes
Professor Id Name DeptId
• MGTP.
17Joins
18Condition boxes
19Insert a tuple
20A bigger example
21
Other table based DBs: Microsoft Access
22Example
23Filemaker