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.
Scenario:
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.
Question:
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:)
Scenario:
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.
Question:
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:)