{
}
Examples:
Tuple Relational Calculus [200]
Find city for supplier S1:
Find S# and SNAME for suppliers in Paris
Find PNAME for parts supplied by supplier S1
Tuple Relational Calculus [201]
{
} where
is a formula:
Note that y is free and x is bound twice.
Tuple Calculus: Example [202]
Schema
Muppets(NAME,ANIMAL,COLOR)
Casting(NAME,SHOW,NETWORK)
Ratings(NETWORK,RANK)
Query
Get the names of all frog muppets.
Algebra
QBE
muppets NAME ANIMAL COLOR P. frog
SQL
SELECT name FROM muppets WHERE animal = `frog'
Tuple
{![]()
'
}
Tuple Calculus: Example [203]
Query
Get the shows casting green muppets.
Algebra
QBE
muppets NAME ANIMAL COLOR _kermit green
casting NAME SHOW NETWORK _kermit P.
SQL
SELECT show FROM muppets,casting
WHERE muppets.name = casting.name
and color = `green'
Tuple
{![]()
![]()
'
}
Tuple Calculus: Example [204]
Query
Get the rankings of all networks casting frogs.
Algebra
QBE
muppets NAME ANIMAL COLOR _kermit frog
casting NAME SHOW NETWORK _kermit _ABC
ratings NETWORK RANK _ABC P.
SQL
SELECT rank FROM muppets,casting,ratings
WHERE muppets.name = casting.name and
casting.network = ratings.network and muppets.animal = `frog'
Tuple
{![]()
![]()
'
![]()
}