Computer Laboratory

Course pages 2013–14

Databases

Never forget to ask What problem am I solving?

Lecture Slides:

A few SQL examples that may clarify the relational implementation of many-to-many and one-to-many relationships (from an ER model).

Relational division example : relational_division.sql.

Some sample supervision question sets and are available for you to use/edit and extend on the Online Teaching Site (courtesy of Andy Rice).

  • Problem set 1 : http://ott.cl.cam.ac.uk/questions/sets/310.
  • Problem set 2 : Prove claims 1 and 2 from Slide 103. Prove soundness from Slide 105. Prove pseudo-transitivity and decompostion (slide 113) using only Armstrong's axioms.
  • Problem set 3 : Extend the "movie release" ER model from slide 146 in order to model multi-region ratings as hinted at in slide 151. Explore the choice between ternary relationships and multiple binary relationships as presented in slides 152 and 153.

Some open source database systems :

  • HyperSQL : http://hsqldb.org.
    • To use from Java code (as used in Further Java) : Unzip the archive file, change to extracted directory, then launch a database GUI with java -cp {YOURPATH}hsqldb.jar org.hsqldb.util.DatabaseManagerSwing.
    • To use the read-execute-print loop use sqltool.jar, java -jar {YOURPATH}sqltool.jar. You may have to set up a sqltool.rc file in your home directory as documented at http://hsqldb.org.
  • Postgres : http://www.postgresql.org/
  • MySQL : http://www.mysql.com/
  • SQLite : http://www.sqlite.org/

Primary sources:

iMDB data:

Of interest (reading for the fun of it):

Never forget to ask What problem am I solving?