Database Relational Algebra

RELATIONAL LANGUAGES:

RELATIONAL ALGEBRA:

It’s a theoratical langauge which wth operations work on one or more relations to define another

relation without changing thte original relation…

FACILITIES: (operations) of relational algebra:

1. Selection(restriction). Selection of rows E,g salary>100(staff).those employ who have
2. salary more than 1000in salary table ..O condition  (R) e.g O salary>100  (Staff)
3. Projection: select columns from a relation. col1,…….coln (R)…… sno,fname,address
4. (Student)
5. Cartesian Product: concatinate rows of one relation to other relation’s record. R * S.. (Sid,name)(strudent)*(cid)(courses)..sid , name are the record of student relations &
6. cid is the record of course table
7. Union: to join two relations…..R ⋃S

union compatible..>data type must be same .

No duplication: no duplicate rows.

1. Difference: tuples which are in R but not n S . R – S ..wat r the members which are
2. in one society but not n another society.
3. Joins Operators: joining of two relations. Join operators are
• Theta Join :matching of two field in two relation. It include =,<,><=,=!…..R ⋈condition S
• Equi join: Teta is general form so for equal it s equal join, for the greater it s greater
• join.
• Natural join: if there are two columns that will become one.
• Outer join: those which are matching & those which are not matching that is complete
• relation. ⊳⊲
• Semi join: DDB(distributd DB) take relations from one side & then relations from other
•  side.  R ⊳f S…where f s  condition or predicate. protocol
4. Intersection: tuples that r n both R & S & must be union-compatible. R ⋂S
5. Division : R S