Professional Documents
Culture Documents
and Queries
Relational Model
A relational model or database consists of multiple relations having
relationship between them
Relation: A table consist of rows and columns.
E.g. Employee, Customer etc.
Attribute : Every column of a relation is referred to as an attribute.
E.g. ssn, empname
Domain : A range of acceptable values for particular attribute is
called domain.
<selection condition>(R)
S2
sid sname rating age
28 yuppy 9 35.0
31 lubber 8 55.5
44 guppy 5 35.0
58 rusty 10 35.0 rating 8(S2)
sid sname rating age
28 yuppy 9 35.0
58 rusty 10 35.0
Selection
NOT(Hobby=‘hiking’) (Person)
Hobby‘hiking’ (Person)
Unary Relational Operations
selects certain columns from the
PROJECT Operation:
table and discards the others.
Example:
sname rating
sname,rating( rating 8(S2)) yuppy 9
rusty 10
SELECT and PROJECT Operations
Result schema similar to cross-product, but only one copy of fields for which
equality is specified.
Natural Join: Equijoin on all common fields.
(Tempboats, ( Boats))
color ' red ' color ' green '
sname(Tempboats Re serves Sailors)