Chapter32

Chapter32 - CSIS0278A CSIS0278A ManagementSystems Lecture 3...

Info icon This preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
CSIS0278A CSIS0278A Introduction to Database  Introduction to Database  Management Systems Management Systems Lecture 3: Relational Model Part 2 Dr. Reynold Cheng Based on the Ch. 2 notes of “Database System Concepts” by A. Silberschatz, H. Korth & S. Sudarshan and notes by Dr. HO Wai Shing
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DB035:2 Overview Overview Additional relational algebra operations Intersection, Join, Division, Assignment Extended relational algebra operations Generalized Projection, Outer join, Aggregate Modification of databases Deletion, Insertion, Updating
Image of page 2
DB035:3 Additional Operations Additional Operations Set intersection Natural join Division Assignment They do not add any power to relational algebra, but simplify common queries .
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DB035:4 Set Intersection Operation –  Set Intersection Operation –  Example  Example  R S Relation R, S A B 1 2 A B 1 2 2 2 A B 1 1 2 1 2 3 R S
Image of page 4
DB035:5 Set Intersection Operation Set Intersection Operation Notation: R S Definition: R S = { t | t R t S } For R S to be valid , R and S must have the same arity , and The attribute domains must be compatible . e.g., Find out all customers who have both an account and a loan π customer_name (Depositor) π customer_name (Borrower) Note that R S = R – (R – S)
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DB035:6 Natural Join Operation –  Natural Join Operation –  Example  Example  R S Relation R, S A C 1 2 2 2 A B 1 1 2 1 2 3 R S A B C 1 1 2 1 2 3 2 2 2
Image of page 6
DB035:7 Natural Join Operation Natural Join Operation Combines information from multiple tables e.g., Natural joining Depositor and Customer creates tuples that contain both account and customer info One of the most commonly used operator!
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DB035:8 Natural Join Operation Natural Join Operation Notation: R S Definition: The schema of R S is R-schema S schema (note: repeated attributes are removed) For each pair of tuples t r from R and t s from S, if t r and t s share the same value over each of the common attributes in R and S, one tuple t will be added to the result of R S. t has the same value as t r in R’s attributes, and t has the same value as t s in S’s attributes. e.g., R(A, B, C, D), S(C, D, E) Schema of R S = (A, B, C, D, E) R S is defined as: π R.A, R.B, R.C, R.D, S.E ( σ R.C = S.C R.D = S.D (R × S))
Image of page 8
DB035:9 Division Operation – Example  Division Operation – Example  Relation R B 1 2 S A B 1 1 2 1 2 2 3 4 4 1 4 4 5 1 5 2 5 3 Q=R ÷ S A 2 5 Q × S R A B 2 1 2 2 5 1 5 2 Largest relation
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Division Operation – Example  Division Operation – Example  1 (cont.)  1 (cont.)  Relation R B 1 2 S A B 1 1 2 1 2 2 3 4 4 1 4 4 5 1 5 2 5 3 Q 0 A B 2 1 2 2 5 1 5 2 3 1 3 2 A 2 5 3
Image of page 10
DB035:11 Division Operation – Example  Division Operation – Example  1 (cont.)  1 (cont.)  Relation R B 1 2 S A B 1 1 2 1 2 2 3 4 4 1 4 4 5 1 5 2 5 3 Q 1 A 2 A=5 is not included in Q 1
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DB035:12 Division Operation – Example 
Image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern