MSc Revision Notes - Database

Useful links

SQL division

Exam topics

Main topics

Other topics

Relational algebra

Relational operators

SQL division

3 sections:

  1. select [whatever] such that
  2. there is no [whatever]
  3. that is not [something]

So, find the name and city of each project supplied with every red part (TABLE 1 / TABLE 2) JNAME, CITY such that there are no red parts that are not supplied:

1. SELECT DISTINCT JNAME, CITY
   FROM PROJECT JOIN SUPPLY S1 ON PROJECT.J# = S1.J#  <-- TABLE 1
   WHERE NOT EXISTS
2. (SELECT * FROM PART WHERE COLOUR = 'RED'  <-- TABLE 2
    AND NOT EXISTS
3.  (SELECT * FROM SUPPLY S2
     WHERE S1.J# = S2.J#
     AND S2.P# = PART.P#))
  1. SELECT attribute FROM t1 t1a WHERE NOT EXISTS

  2. (SELECT * FROM t2 WHERE NOT EXISTS

  3. (SELECT * FROM t1 t1b WHERE t1a.t1key = t1b.t1key AND t1b.t2key = t2.t2key))

Transactions

Checkpointing


CategoryBbkRevision

DatabaseRevision (last edited 2006-04-24 20:44:17 by DavidKeen)