230 likes | 327 Views
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.
E N D
The algebra 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 Some of this material was taken from
The set of all allowable values that a function can act on and return a meaningful result. A domain 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 A calculus is
It is a tuple calculus • Variables represent conceptual tuples from a table, derived table, or singleton • One can also create domain calculi SQL
Form of query: {T | Condition(T)} T is the target– a variable that ranges over tuples of values Condition 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 Tuple calculus
{T | Teaching(T) AND T.Semester = ‘F2000’} Is the same as: SELECT * FROMTeaching T WHERET.Semester = ‘F2000’ Example
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 Domain calculus
{X1 , …, Xn | condition(X1 , …, Xn)} {Pid, Code | Teaching(Pid, Code, ‘F1997’)} Domain calculus expression
Algebra: R– S • TRC: {T | R(T) AND NOTS(T)} • DRC: {A,B,C | R(A,B,C) ANDNOTS(A,B,C) } Example
Declarative query language, like SQL • Based on DRC (rather than TRC) • Visual A visual interface
Professor Id Name DeptId • Print all professors’ names in the MGT department P._John MGT The QBE interface
Professor Id Name DeptId • MGT P. Return all attributes
Professor Id Name DeptId P._John _123 Joins