Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Student(Sno, Sname) Professor(Eno, Ename, Dept, Office) . Course(Cno, Cname) . Prerequisite(Cno, Prereq) Enrollment (Sno, Cno, Term, Section, Mark) . Schedule(Cno, Term, Section, Days, Time, Room)

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

Student(Sno, Sname) Professor(Eno, Ename, Dept, Office) . Course(Cno, Cname) . Prerequisite(Cno, Prereq) Enrollment (Sno, Cno, Term, Section, Mark) . Schedule(Cno, Term, Section, Days, Time, Room) . Class(Cno, Term, Section, Instructor) The relation Professor stores information on professors. Eno is the employee number. Ename and Office are the name of a professor and his/her office, respectively. Dept indicates the department with which a professor is affiliated. Prerequisite stores the information on prerequisites of a course. All other relations should be self-explanatory For each relation, the underlned attributes form the primary key. Student (and Course, respectively) the relation Course Course (and Professor, respectively). referencing the Class relation The attribute Sno (and Cno) in the Enrollment relation is a foreign key referencing the relation Each of the attributes Cno and Prereq in the Prerequisite relation is a foreign key referencing The attribute Cno (and Instructor) in the Class relation is a foreign key referencing the relation The attributes Cno, Term and Section in the Enrollment and Schedule relations is a foreign key You may assume the domain of Days is M, T, W, R, F. The domain of Term consists of strings of length 3, where the first two digits indicating the year while the last character representing the term. The domain of Mark is the set of integers from 1 to 100. The domain of Section is a single integer from 1 to 9. The domains of Sno, Eno and Instructor are integers. The domain of Time is Date/Time. The domains of other attributes are character strings What to submit: (a) Answer each of the following with an algebraic expression using only union, set difference, Cartesian product, natural join, select, project and rename operators. Explain your answers by stating the meaning of each sub-expression if there is any. (i.) List all student names who took a course taught by a CS professor. A student took a course if the student enrolled in a section of the course and obtained a non-zero mark. You may assume "CS" is a value in the domain of Dept. (ii.) List all students (names) who took a course from a department that has a professor with the same name as the student. A student took a course from a department if the student enrolled in a section of the course in some term and the section was taught by a professor from the department. Note that the professor who taught the class taken by the student may have a different name from the student. (iii.) Find students (Sno and Sname) who whenever took a course, the mark obtained is above 80. A student is said to take a course if there is an enrollment tuple involving the student and has a positive mark. We are only interested in those students taking at least one course (iv.) Find students (Sno) who enrolled in a course for which s/he does not have the prerequisite. A student is said to have no prerequisite for a course if there is a prerequisite P of the course, the student either never enrolled in P or was enrolled in P but failed to obtain a grade of 50 or more. You may assume that no student can enroll in a course and completing a prerequisite at the same or later term. (b) Prove that the natural join operator is commutative (i.e. R * S -S*R) and associative (i.e. (R * S) * T = R * (S * T)). This implies a sequence of natural Joins can be evaluated in any order Student(Sno, Sname) Professor(Eno, Ename, Dept, Office) . Course(Cno, Cname) . Prerequisite(Cno, Prereq) Enrollment (Sno, Cno, Term, Section, Mark) . Schedule(Cno, Term, Section, Days, Time, Room) . Class(Cno, Term, Section, Instructor) The relation Professor stores information on professors. Eno is the employee number. Ename and Office are the name of a professor and his/her office, respectively. Dept indicates the department with which a professor is affiliated. Prerequisite stores the information on prerequisites of a course. All other relations should be self-explanatory For each relation, the underlned attributes form the primary key. Student (and Course, respectively) the relation Course Course (and Professor, respectively). referencing the Class relation The attribute Sno (and Cno) in the Enrollment relation is a foreign key referencing the relation Each of the attributes Cno and Prereq in the Prerequisite relation is a foreign key referencing The attribute Cno (and Instructor) in the Class relation is a foreign key referencing the relation The attributes Cno, Term and Section in the Enrollment and Schedule relations is a foreign key You may assume the domain of Days is M, T, W, R, F. The domain of Term consists of strings of length 3, where the first two digits indicating the year while the last character representing the term. The domain of Mark is the set of integers from 1 to 100. The domain of Section is a single integer from 1 to 9. The domains of Sno, Eno and Instructor are integers. The domain of Time is Date/Time. The domains of other attributes are character strings What to submit: (a) Answer each of the following with an algebraic expression using only union, set difference, Cartesian product, natural join, select, project and rename operators. Explain your answers by stating the meaning of each sub-expression if there is any. (i.) List all student names who took a course taught by a CS professor. A student took a course if the student enrolled in a section of the course and obtained a non-zero mark. You may assume "CS" is a value in the domain of Dept. (ii.) List all students (names) who took a course from a department that has a professor with the same name as the student. A student took a course from a department if the student enrolled in a section of the course in some term and the section was taught by a professor from the department. Note that the professor who taught the class taken by the student may have a different name from the student. (iii.) Find students (Sno and Sname) who whenever took a course, the mark obtained is above 80. A student is said to take a course if there is an enrollment tuple involving the student and has a positive mark. We are only interested in those students taking at least one course (iv.) Find students (Sno) who enrolled in a course for which s/he does not have the prerequisite. A student is said to have no prerequisite for a course if there is a prerequisite P of the course, the student either never enrolled in P or was enrolled in P but failed to obtain a grade of 50 or more. You may assume that no student can enroll in a course and completing a prerequisite at the same or later term. (b) Prove that the natural join operator is commutative (i.e. R * S -S*R) and associative (i.e. (R * S) * T = R * (S * T)). This implies a sequence of natural Joins can be evaluated in any order

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions