Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2013

    Exclamation Relational Algebra Question

    Hey guys, I am studying for an Exam, and was hoping for some guidance on a particular Relational Algebra question I am not sure on.


    Consider the database schema on the relations (where key attributes have been underlined):

    COURSES(Number, Faculty, CourseName)
    STUDENTS(RegNumber, Surname, FirstName, Faculty)
    EXAMS(Student, Course, Grade, Date)

    NOTE: relation EXAMS stores the registration number (attribute Student) of students that passed the exam for a given course (attribute Course is the number of course, not the name of the course), the grade and the date of the exam.


    Formulate in relational algebra the query that retrieves for every course number in the Science faculty, the registration number and surname of students who passed the exam for such a course during the period 01/05/2010-15/05/2010.

    My Answer

    PROJECT Number, RegNumber, Surname (RESTRICT date > 30/04/2010 AND date < 16/05/2010 AND Grade > E(Courses JOIN r.number=Course Exams AND Students JOIN r.RegNumber = Student Exams))

    Do you guys think my answer is correct? If not, what should I change? Thanks

  2. #2
    Join Date
    Jan 2003
    Not too sure about the syntax, but one point about the RESTRICT clause, does the Date attribute include a time portion? If it does, then someone who takes and passes the exam at noon on 30/04/2010 will show up in your result set. Also, I don't see anything about the Science faculty. Lastly, since I don't know the syntax you are using, I see r.Number, and r.RegNumber, is "r" an alias for the Exams table? Does it need to be declared?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts