Relational Algebra Operations From Set Theory: Cartesian Product (Cross Product or Cross Join)
Relational Algebra Operations From Set Theory: Cartesian Product (Cross Product or Cross Join)
UNION, INTERSECTION and MINUS (or SET DIFFERENCE or EXCEPT) RS=((RUS)-(R-S))-(S-R) RUS=SUR and RS=SR RU(SUT)=(RUS)UT and R(ST)=(RS) T R-SS-T SQL operations are UNION, INTERSECT, EXCEPT, UNION ALL, INTERSECT ALL, EXCEPT ALL. All may not be available in all flavors or sqls. CARTESIAN PRODUCT (CROSS PRODUCT or CROSS JOIN) o Denoted by x o Binary set operation o Relations do not have to be union compatible (different r=columns can be joined) o Generally not useful by itself useful when followed by a selection that matches values of attributes. Ex: to select depnedents of female employees, select fname,lname,dependent_name from employee,dependent where employee.sex=F and employee.ssn=dependent.essn; JOIN and DIVISION o JOIN Denoted by Combine related tuples from two relations into single relation with longer tuples. Example DEPT_MGRDEPARTMENT Mgr_ssn=Ssn EMPLOYEE, RESULT Dname,Fname,Lname (DEPT_MGR) JOIN general form R|><| <join condition> S Theta join uses =,>,<, >=, <= and in join conditions Equijoin subset of theta join with condition = Natural join Denoted by *, Removes second (superfluous) attribute in an EQUIJOIN condition. Cross check for employee JOIN SELECTIVITY