Chapter 3 Supplemental Slides Relational Division Demonstration Welcome to the relational division demonstration: - Supplemental slides for chapters 3 and 9 - More of an interactive demonstration than an animation - See the derivation of rows in the result of a relational division operation - Demonstration should help you understand relational division, a more complex operator than the join operator - Division problems are not common - Important when occurring - Provide expert query formulation knowledge - This demonstration complements the static presentation in the lecture notes and textbook. - Play it yourself at your own pace
Relational Division Animation Part PartNo P1 P2 P3 SuppPart SuppNo PartNo S2 P3 S3 P1 S1 P2 Relational division: - Specialized operator for subset matching - Find suppliers who supply an interesting subset of parts - Find professors who teach an interesting subset of courses - Find students who have taken an interesting subset of courses Table structure: - Two column table divided by a one column table - Can be extended for tables with more columns but not necessary for this course Table structure - SuppPart table: combinations of suppliers and parts; M-N relationship between Supp and Part tables - Part table: contains all parts; only show the PartNo column Problem: - List SuppNo values that are associated with all (every) PartNo - Difficult to see: S2 is associated with P1, P2, and P3 - Rearrange values of SuppPart table to see more clearly the associations between SuppNo and PartNo values
Relational Division Animation SuppPart SuppNo PartNo S1 P1 P3 S2 P2 S3 Part PartNo P1 P2 P3 Sort the SuppPart table by SuppNo - Easier to see that only S2 should be in the result Let’s see operation of the division operator for each SuppNo value in the SuppPart table Sort SuppPart by SuppNo
Relational Division Animation SuppPart SuppNo PartNo S1 P1 P3 S2 P2 S3 Part PartNo P1 P2 P3 Result table contains a single column: SuppNo Processing of first SuppNo value: - SuppNo S1 is associated with PartNo P1 and P2 - SuppNo S1 is not in the result SuppPart DIVIDEBY Part SuppNo S1 {P1, P3} does not contain {P1, P2, P3}.
Relational Division Animation SuppPart SuppNo PartNo S1 P1 P3 S2 P2 S3 Part PartNo P1 P2 P3 Processing of second SuppNo value: - SuppNo S2 is associated with PartNo P1, P2, and P3 - SuppNo S2 is in the result SuppPart DIVIDEBY Part SuppNo S2 S2 {P1, P2, P3} contains {P1, P2, P3}.
Relational Division Animation SuppPart SuppNo PartNo S1 P1 P3 S2 P2 S3 Part PartNo P1 P2 P3 Processing of last SuppNo value: - SuppNo S3 is associated with PartNo P1 - SuppNo S3 is not in the result SuppPart DIVIDEBY Part SuppNo S2 S3 {P1} does not contain {P1, P2, P3}.