Chapter 4:Intermediate SQL Join Expressions Views Transactions Integrity Constraints SQL Data Types and Schemas Authorization Database System Concepts-6th Edition 4.2 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 6 4.2 ©Silberschatz, Korth and Sudarshan th Edition Chapter 4: Intermediate SQL Join Expressions Views Transactions Integrity Constraints SQL Data Types and Schemas Authorization
Joined Relations Join operations take two relations and return as a result another relation. A join operation is a Cartesian product which requires that tuples in the two relations match (under some condition). It also specifies the attributes that are present in the result of the join The join operations are typically used as subquery expressions in the from clause Database System Concepts-6th Edition 4.3 @Silberschatz,Korth and Sudarshan
Database System Concepts - 6 4.3 ©Silberschatz, Korth and Sudarshan th Edition Joined Relations Join operations take two relations and return as a result another relation. A join operation is a Cartesian product which requires that tuples in the two relations match (under some condition). It also specifies the attributes that are present in the result of the join The join operations are typically used as subquery expressions in the from clause
Join operations -Example Relation course course id title dept name credits BIO-301 Genetics Biology 4 CS-190 Game Design Comp.Sci. 4 CS-315 Robotics Comp.Sci. 3 Relation prereg course id prereg id BIO-301 BIO-101 CS-190 CS-101 CS-347 CS-101 Observe that prereq information is missing for CS-315 and course information is missing for CS-437 Database System Concepts-6th Edition 4.4 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 6 4.4 ©Silberschatz, Korth and Sudarshan th Edition Join operations – Example Relation course Relation prereq Observe that prereq information is missing for CS-315 and course information is missing for CS-437
Outer Join An extension of the join operation that avoids loss of information. Computes the join and then adds tuples form one relation that does not match tuples in the other relation to the result of the join. Uses null values. Database System Concepts-6th Edition 4.5 @Silberschatz,Korth and Sudarshan
Database System Concepts - 6 4.5 ©Silberschatz, Korth and Sudarshan th Edition Outer Join An extension of the join operation that avoids loss of information. Computes the join and then adds tuples form one relation that does not match tuples in the other relation to the result of the join. Uses null values
Left Outer Join course natural left outer join prereg course id title dept name credits prereq id BIO-301 Genetics Biology 4 BIO-101 CS-190 Game Design Comp.Sci. 4 CS-101 CS-315 Robotics Comp.Sci. 3 null Database System Concepts-6th Edition 4.6 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 6 4.6 ©Silberschatz, Korth and Sudarshan th Edition Left Outer Join course natural left outer join prereq