DOC PREVIEW
SJSU CS 157A - RELATIONAL ALGEBRA

This preview shows page 1-2-3-23-24-25-26-47-48-49 out of 49 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

RELATIONAL ALGEBRA (III)Slide 2Slide 3Unary Relational Operations: SELECT and PROJECTRelational Algebra Operations from Set TheoryBinary Relational Operations: JOIN and DIVISIONAdditional Relational OperationsSPECIAL RELATIONAL OPERATORSJOIN OPERATORSSlide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Functional DependencyFunctional DependenciesA®C, but not C®AMinimal cover: AB, DB {A, B, C, D} is a candidate keySlide 25Slide 26ClosureSlide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Minimal coverSlide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Candidate Keys… candidate keykeys and dependenciesSlide 48Trivial Functional DependencyRELATIONAL ALGEBRA RELATIONAL ALGEBRA (III)(III)Prof. Sin-Min LEEProf. Sin-Min LEEDepartment of Computer Department of Computer ScienceScienceUnary Relational Operations: SELECT and Unary Relational Operations: SELECT and PROJECTPROJECTThe PROJECT OperationThe PROJECT OperationSequences of Operations and the Sequences of Operations and the RENAME OperationRENAME OperationThe SELECT OperationThe SELECT OperationRelational Algebra Operations from Set Relational Algebra Operations from Set TheoryTheoryThe UNION, INTERSECTION, and The UNION, INTERSECTION, and MINUS OperationsMINUS OperationsThe CARTESIAN PRODUCT (or CROSS The CARTESIAN PRODUCT (or CROSS PRODUCT) OperationPRODUCT) OperationBinary Relational Operations: JOIN and Binary Relational Operations: JOIN and DIVISIONDIVISIONThe JOIN OperationThe JOIN OperationThe EQUIJOIN and NATURAL JOIN The EQUIJOIN and NATURAL JOIN Variations of JOINVariations of JOINA Complete Set of Relational Algebra A Complete Set of Relational Algebra OperationsOperationsThe DIVISION OperationThe DIVISION OperationAdditional Relational OperationsAdditional Relational OperationsAggregate Functions and GroupingAggregate Functions and GroupingRecursive Closure OperationsRecursive Closure OperationsOUTER JOIN OperationsOUTER JOIN OperationsThe OUTER JOIN OperationThe OUTER JOIN OperationSPECIAL RELATIONAL OPERATORSSPECIAL RELATIONAL OPERATORSThe following operators are peculiar to relations:The following operators are peculiar to relations:- - Join operatorsJoin operatorsThere are several kind of join operators. We only consider There are several kind of join operators. We only consider three of these here (others will be considered when we three of these here (others will be considered when we discuss null values):discuss null values):- (1) Condition Joins- (1) Condition Joins- (2) Equijoins- (2) Equijoins- (3) Natural Joins- (3) Natural Joins- - DivisionDivisionJOIN OPERATORSJOIN OPERATORS Condition Joins: Condition Joins: - Defined as a cross-product followed by a selection:- Defined as a cross-product followed by a selection: R R ⋈⋈cc S = S = σσcc(R (R  S) ( S) ( is called the ⋈ is called the ⋈bow-tie)bow-tie)where c is the condition.where c is the condition.- - Example:Example:Given the sample relational instances S1 and R1Given the sample relational instances S1 and R1The condition join S ⋈S1.sid<R1.sid R1 yieldsJOIN OPERATORSJOIN OPERATORS Condition Joins: Condition Joins: - Defined as a cross-product followed by a selection:- Defined as a cross-product followed by a selection: R R ⋈⋈cc S = S = σσcc(R (R  S) ( S) ( is called the ⋈ is called the ⋈bow-tie)bow-tie)where c is the condition.where c is the condition.- - Example:Example:Given the sample relational instances S1 and R1Given the sample relational instances S1 and R1The condition join S ⋈S1.sid<R1.sid R1 yieldsEquijoinEquijoin::Special case of the condition join where the join condition consists solely Special case of the condition join where the join condition consists solely of equalities between two fields in R and S connected by the logical of equalities between two fields in R and S connected by the logical AND operator (AND operator ().∧).∧ExampleExample: Given the two sample relational instances S1 and R1: Given the two sample relational instances S1 and R1The operator S1 R.sid=Ssid R1 yieldsNatural JoinNatural Join- Special case of equijoin where equalities are implicitly - Special case of equijoin where equalities are implicitly specified on specified on all all fields having the same name in R and S.fields having the same name in R and S.- The condition c is now left out, so that the “bow tie” - The condition c is now left out, so that the “bow tie” operator by itself signifies a natural join.operator by itself signifies a natural join.- - N. B.N. B. If the two relations have no attributes in common, the If the two relations have no attributes in common, the natural join is simply the cross-product.natural join is simply the cross-product.Functional DependencyFunctional Dependency holds on schema R if, in any holds on schema R if, in any legal relation r(R), for all pairs of legal relation r(R), for all pairs of tuples ttuples t11 and t and t22 in r such that t in r such that t11[[] ] = t= t22[[], it is also the case that t], it is also the case that t11 [[] = t] = t22 [ [].].Functional DependenciesFunctional DependenciesFDs defined over two FDs defined over two sets of attributes: X, sets of attributes: X, Y Y  R RNotation: X Notation: X  Y reads Y reads as “X determines Y”as “X determines Y”If X If X  Y, then all tuples Y, then all tuples that agree on X must that agree on X must also agree on Yalso agree on YX Y Z1 2 32 4 51 2 41 2 72 4 83 7 9RAAC, but not CC, but not CAAAABBCCDDtt00aa11bb11cc11dd11tt11aa11bb22cc11dd22tt22aa22bb22cc22dd22tt33aa22bb22cc22dd33tt44aa33bb33cc33dd44tt55aa44bb33cc33dd44Minimal cover: AMinimal cover: AB, DB, DBB{A, B, C, D} is a candidate key{A, B, C, D} is a candidate keyRR(A(ABBCCD)D)1122112222331133112233113322113311223322X Y Z1 2 32 4 51 2 41 2 72 4 83 7 9X Y ZFunctional Dependencies Functional Dependencies GraphGraph(example)(example)ClosureClosureLet F be a set of functional Let F be a set of functional dependencies.dependencies.The closure of F, denoted by FThe closure of F, denoted by F++, is the , is the set of all functional dependencies set of all functional dependencies logically implied by F.logically implied by F.Minimal coverMinimal coverThe concept of minimal cover of F


View Full Document

SJSU CS 157A - RELATIONAL ALGEBRA

Documents in this Course
SQL

SQL

18 pages

Lecture

Lecture

44 pages

Chapter 1

Chapter 1

56 pages

E-R Model

E-R Model

16 pages

Lecture

Lecture

48 pages

SQL

SQL

15 pages

SQL

SQL

26 pages

Lossless

Lossless

26 pages

SQL

SQL

16 pages

Final 3

Final 3

90 pages

Lecture 3

Lecture 3

22 pages

SQL

SQL

25 pages

Load more
Download RELATIONAL ALGEBRA
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view RELATIONAL ALGEBRA and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view RELATIONAL ALGEBRA 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?