132a - { a: actor | ALL m in movie [ m(director) = Berto...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Translation steps: Query in English -> queyr in TRC -> if has A, eliminate A -> sql query 1. { t: theater | A m e Movie E S e schedule[s(title) = m(title) and S(theater) = t(theater)] Everybody likes ___ = nobody doesn’t like ____ = {t: theater | not E m e Movie not E s e Schedule[…] A = not E Select t.theater From schedule t Where not exists ( Select * from movie m where not exists ( Select * from schedule S where s.title = m.tiele and s.theater = t.theater. ) ) List the sailors who reserved every red boat != list sailors who didn’t reserve no red boats. List sailors who didn’t reserve all red bots Get color first, then check sailor name with reservation with bname Select t.theater from schedule t where not exists ( Select * from movie m where not exists ( Select * from schedule s where s.title = m.title and theater t = s.theater ) ) There exists a tuple t such that for all m in movie, there exists an s schedule that s.title = m.title and t.theater = s.theater Find actors playing in every movie by berto.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { a: actor | ALL m in movie [ m(director) = Berto -> EXISTS t in movie [m(title) = t(title) and t(actor) = a(actor) ]] Xxxxxxxxxxxxx So {a: actor | ~E m in movie [m(director) = Berto -> exists t in movie [m(title) = t(title) and t(actor) = a(actor)]] P ->q = ~(p v q) ============ ~p and ~q {a:actor | ~E m in movie ~(~m(director) = berto) or E t in movie[m(title) = t(title) and t(actor)]} <= eliminate the not not { a: actor outer query| subquery2 ~ E m in movie(m(director) = berto) and ~ E t where movie[m(title = t.title and t(actor) = a(actor))] Select a.actor from movie a where not exists( Select * from movie m where m.director = berto and not exists( Select * from movie t where m.title = t.title and t.actor = a.actor)) select s.sname from reservation s where not exists( select * from reservation r where r.sname = s.sname and not exists( select * from boat b where b.bname = r.bname and boat.color like red ))...
View Full Document

This note was uploaded on 01/09/2012 for the course CSE 132A taught by Professor Alindeutsch during the Spring '08 term at UCSD.

Ask a homework question - tutors are online