views:

82

answers:

1

I have a Databases exam tomorrow and I have been running over some past papers to check whether my relational algebra knowledge is up to a decent standard or not.

If it isn't I'm going to stop working on it now and focus on other possible question types (DDL, Normalization) that may also arise.

If it needs just a little bit of work then I might carry on with it but obviously I need someone to tell me if what I am doing is correct or not!

Here are the questions:

Questions

And here are my answers:

Answers

Hopefully my writing is legible enough for you guys to understand. If I am totally way off course with my answers then just let me know, as that is what I suspect to be true anyway as I still don't think I'm getting it.

Thank you!

A: 

My answers:

  1. selection[rating = "E"] (sailor)
  2. projection[s_name,age] (selection[rating="C"] (sailor))
  3. projection[s_names] (selection[bid=202](sailor * reserve))
  4. projection[colour] (selection[s_name="James Johanson"] (sailor * boat * reserve)
  5. projection[s_name] (selection[colour="red"] (sailor * boat * reserve) \ selection[colour="green"] (sailor * boat * reserve)

Operations:

  • selection: select rows
  • projection: select columns
  • * : join tables with equal named rows
  • \ : as in set algebra

I use the terms row, column and table instead of tuple, attribute and relation as it is easier to understand it that way.

simonh
I don't think that '\' is necessarily all that standard - at least, the majority of the documents I've read do not use it.
Jonathan Leffler