Set Difference Operation Notation r-s Defined as: r-s={tlt∈rand tgs} Set differences must be taken between compatible relations. r and s must have the same arity attribute domains of r and s must be compatible Example:to find all courses taught in the Fall 2009 semester,but not in the Spring 2010 semester Ilcourse_id(o semester="Fall year=2009(section) Icourse_id(semester="Spring"Ayear=2010(section)) Database System Concepts-6th Edition 6.7 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 6 6.7 ©Silberschatz, Korth and Sudarshan th Edition Set Difference Operation Notation r – s Defined as: r – s = {t | t r and t s} Set differences must be taken between compatible relations. r and s must have the same arity attribute domains of r and s must be compatible Example: to find all courses taught in the Fall 2009 semester, but not in the Spring 2010 semester course_id ( semester=“Fall” Λ year=2009 (section)) − course_id ( semester=“Spring” Λ year=2010 (section))
Set-Intersection Operation Notation:r∩s Defined as: ros={tlt∈rand t∈s} Assume: r,s have the same arity attributes of r and s are compatible Note:r∩s=r-(r-s) Database System Concepts-6th Edition 6.8 @Silberschatz,Korth and Sudarshan
Database System Concepts - 6 6.8 ©Silberschatz, Korth and Sudarshan th Edition Set-Intersection Operation Notation: r s Defined as: r s = { t | t r and t s } Assume: r, s have the same arity attributes of r and s are compatible Note: r s = r – (r – s)
Cartesian-Product Operation Notation rx s Defined as: rxs={tqlt∈r and q∈s} Assume that attributes of r(R)and s(S)are disjoint.(That is,RS=. If attributes of r(R)and s(S)are not disjoint,then renaming must be used. Database System Concepts-6th Edition 6.9 @Silberschatz,Korth and Sudarshan
Database System Concepts - 6 6.9 ©Silberschatz, Korth and Sudarshan th Edition Cartesian-Product Operation Notation r x s Defined as: r x s = {t q | t r and q s} Assume that attributes of r(R) and s(S) are disjoint. (That is, R S = ). If attributes of r(R) and s(S) are not disjoint, then renaming must be used
Rename Operation Allows us to name,and therefore to refer to,the results of relational- algebra expressions. Allows us to refer to a relation by more than one name. Example: Px(E) returns the expression E under the name X If a relational-algebra expression E has arity n,then Px(4424n)(E) returns the result of expression E under the name X,and with the attributes renamed to A1,A2,....,An Database System Concepts-6th Edition 6.10 @Silberschatz,Korth and Sudarshan
Database System Concepts - 6 6.10 ©Silberschatz, Korth and Sudarshan th Edition Rename Operation Allows us to name, and therefore to refer to, the results of relationalalgebra expressions. Allows us to refer to a relation by more than one name. Example: x (E) returns the expression E under the name X If a relational-algebra expression E has arity n, then returns the result of expression E under the name X, and with the attributes renamed to A1 , A2 , …., An . ( ) ,..., ) 2 , 1 ( E n x A A A