Chapter32

# Chapter32 - CSIS0278A CSIS0278A ManagementSystems Lecture 3...

• Notes
• 42
• 100% (1) 1 out of 1 people found this document helpful

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

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

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

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
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 .

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

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
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)

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

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
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!

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

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))
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

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

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
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

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

DB035:12 Division Operation – Example
This is the end of the preview. Sign up to access the rest of the document.
• Spring '10
• DR
• Relational model, Outer Join, relational algebra operations

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern