lec06.365

lec06.365 - . . Fall 2007 CPE/CSC 365: Introduction to...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: . . Fall 2007 CPE/CSC 365: Introduction to Database Systems Alexander Dekhtyar . . Relational Algebra. Part 1. Definitions. Relational Algebra Notation R,T,S,... relations. t,t 1 ,t 2 ,... tuples of relations. t ( n ) tuple with n attributes. t [1] ,t [2] ,...,t [ n ] 1st, 2nd,. . . nth attribute of tuple t . t.name attribute name of tuple t (attribute names and numbers are inter- changable ). R.name,R [1] ,... attribute name or attribute number 1 (etc.) of relation R . R ( X 1 : V 1 ,...,X n : V n ) relational schema specifying relation R with n attributes X 1 ,...,X n of types V 1 ,...,V n . We let V i specify both the type and the set of possible values in it. Base Operations Union Definition 1 Let R = { t } and S = { t } be two relations over the same rela- tional schema. Then, the union of R and S , denoted R S is a relation T , such that: T = { t | t R or t S } . Union of two relations combines in one relation all their tuples. Note: it is important to note that for union to be applicable to two relations R and S , they must have the same schema . 1 Difference Definition 2 Let R and S be two relations over the same relational schema. Then, the difference of R and S , denoted R S is a relation T such that: T = { t | t R and t negationslash S } . Difference of two relations R and S is a relation that contains all tuples from R that are not contained in S . Cartesian Product Definition 3 Let R and S be two relations. The cartesian product of R and S , denoted R S is a relation T such that: T = { t | t = ( a 1 ,...,a n ,b 1 ,...,b m ) ( a 1 ,...,a n ) R ( b 1 ,...,b m ) S } . Cartesian product glues together all tuples of one relation with all tuples of the other one. Selection Definition 4 Let database D consist of relations R 1 ,...R n . Let X,Y be at- tributes of one of the relations R 1 ,...R n . An atomic selection condition is an expression of one of the forms: X op ; X op Y, where V and V is X s domain; op { = , negationslash = ,<,>, , } and X and Y have comparable types....
View Full Document

This note was uploaded on 05/19/2008 for the course CSC 365 taught by Professor Dekhtyar during the Spring '08 term at Cal Poly.

Page1 / 6

lec06.365 - . . Fall 2007 CPE/CSC 365: Introduction to...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online