Question

In: Computer Science

The following relations are part of a school database: STUDENT(STUD#, STUD_NAME, MAJOR, YEAR, GPA) TEACHER(FACULTY#, DEPT,...

The following relations are part of a school database:

STUDENT(STUD#, STUD_NAME, MAJOR, YEAR, GPA)

TEACHER(FACULTY#, DEPT, TEACHERNAME)

ENROLLMENT(STUD#, COURSE#, GRADE)

RESPONSIBILITY(FACULTY#, COURSE#)

Using PROJECT, SELECT and JOIN, write the sequence of operations to answer each of the following questions:

What are the names of teachers who are responsible for courses in which students whose name is 'JONES' are enrolled?

Use relational Algebra and relational calculus for this question.

Solutions

Expert Solution

select teachername from teacher ------ we only need teacher name

where teacher.facultyno = responsibility.facultyno --------------- join between teacher and responsibility as facultyno is the common column (foreign key) to get the teacher details

and responsibility.courseno = enrollment.courseno ---------- join between responsibility and enrollment on courseno to get the coursedetails

and enrollment.studentno = student.studentno ------------- join between enrollment and student on studentno to get the student names

and student.stud_name = 'JONES'; ------------- as per question , the student name would be 'JONES'

If we try to frame the sql with the help of relational algebra then,

The Relational Algebra is:

Πteachername facultyno courseno ((Πstudentno σstud_name = 'JONES'   STUDENT) X ENROLLMENT ) X RESPONSIBILITY ) X TEACHER)

here X symbolises cartesian product.

-----------------------------------------------------------------

If we want to frmae the above SQL with the help of Tuple Relational Calculas , it would be:

{T | ∃T1 ∈ TEACHER(∃Z ∈ RESPONSIBILITY (∃X ∈ STUDENT(X.stud_name =’JONES’∧ ∃Y ∈ ENROLLMENT (Y. studentno = X. studentno ∧ Y. courseno = Z. courseno ∧ Z. facultyno = T 1. facultyno )) ∧ T. teachername = T1. teachername)}

In both the answers, the joinnings are done based upon the SQL written at the starting.


Related Solutions

Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname,...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname, major-dept, year) Courses (cid, cname, dept, credithours) Enrollment (sem-year, sid, cid, grade) Teaches (pid, cid, sem-year, class-size) where, Professors: All professors have professor id (pid), name (pname), department that they work (dept), and a phone number extension for their office (ext). Students: All students have id (sid), name (sname), department for their major (major-dept), and a year (year i.e, freshman, sophomore, junior, etc). Courses:...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname,...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname, major-dept, year) Courses (cid, cname, dept, credithours)Enrollment (sem-year, sid, cid, grade) Teaches (pid, cid, sem-year, class-size), Professors: All professors have professor id (pid), name (pname), department that they work (dept), and a phone number extension for their office (ext). Students: All students have id (sid), name (sname), department for their major (major-dept), and a year (yeari.e, freshman, sophomore, junior, etc). Courses: All courses have...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname,...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname, major-dept, year) Courses (cid, cname, dept, credithours) Enrollment (sem-year, sid, cid, grade) Teaches (pid, cid, sem-year, class-size) where, Professors: All professors have professor id (pid), name (pname), department that they work (dept), and a phone number extension for their office (ext). Students: All students have id (sid), name (sname), department for their major (major-dept), and a year (year i.e, freshman, sophomore, junior, etc). Courses:...
Faculty positions in a school district are classified as either teacher or administrator based on primary...
Faculty positions in a school district are classified as either teacher or administrator based on primary duties and responsibilities. The table below shows information on the number of national board-certified and not board-certified teachers and administrators. Board-certified Not board-certified Administrator 10 6 Teacher 5 18 Determine the probability, ?(board-certified or teacher), that a randomly chosen faculty member is either board-certified or a teacher. Please enter your answer as a decimal, precise to at least four decimal places. ?(board-certified or teacher)...
Seeb Hospital provides the following information for the year of 2018. Dept. E Dept. F Dept....
Seeb Hospital provides the following information for the year of 2018. Dept. E Dept. F Dept. G Dept. H Budgeted Hours 10,000 8,000 21,000 1,000 Actual Hours 12,000 8,000 22,0 1,200 Yearly maintenance hours 40,000 Allocation Rate Budgeted maintenance hours Maintenance costs: Fixed OMR5,400,000 yearly Variable OMR30 per maintenance hour (9 Marks (0) Calculate the amount of maintenance cost budgeted for each department assuming a single-rate cost-allocation method was used
schema: Student( studID, name, major )   // dimension table, studID is key Instructor( instID, dept );  ...
schema: Student( studID, name, major )   // dimension table, studID is key Instructor( instID, dept );   // dimension table, instID is key Class( classID, univ, region, country );   // dimension table, classID is key Took( studID, instID, classID, score );   // fact table, foreign key references to dimension tables Write a SQL query to find all students who took a class from an instructor not in the student's major department and got a score over 80. Return the student name,...
A database schema consisting of three relations STUDENT, COURSE, and STAFF is created as follows: CREATE...
A database schema consisting of three relations STUDENT, COURSE, and STAFF is created as follows: CREATE TABLE STUDENT (STU_ID CHAR(4), STUDENT_NAME CHAR(20), ADDRESS CHAR(20), BIRTHDATE DATE, GENDER CHAR(6)); CREATE TABLE COURSE (COURSE_ID CHAR(6), COURSE_TITLE CHAR(20), STAFF_ID CHAR(3), SECTION NUMBER(2)); CREATE TABLE STAFF (STAFF_ID CHAR(3), STAFF_NAME CHAR(20), GENDER CHAR(6), DEPARTMENT CHAR(20), BOSS_ID CHAR(3) SALARY NUMBER(8,2)); Write down SQL statement for each query below: 1) Find out the information of staff members who are female and earn either below $5,000 or above...
A loan company wants to design a database to track student loans. Each student attending school...
A loan company wants to design a database to track student loans. Each student attending school is eligible for a loan. A student may have more than one loan. A student may be registered, possibly at different times, in more than one school. Each loan should belong to only one bank. Each bank can approve as many loans as it desires. For each loan, the loan company will track: the student’s SSN, name, address, amount of loan, date of the...
A loan company wants to design a database to track student loans. Each student attending school...
A loan company wants to design a database to track student loans. Each student attending school is eligible for a loan. A student may have more than one loan. A student may be registered, possibly at different times, in more than one school. Each loan should belong to only one bank. Each bank can approve as many loans as it desires. For each loan, the loan company will track: the student’s SSN, name, address, amount of loan, date of the...
1.) What is the probability that a randomly selected female student had a high school GPA...
1.) What is the probability that a randomly selected female student had a high school GPA lower than 3.75? Solve this problem using the Standard Normal Table (Z table). Show all work and provide the probability as a decimal rounded to four decimal places. 2.) ​​​​​​​If a female student had a high school GPA of 4.00, what percentile would this be for all female students? Solve this problem using the Standard Normal Table (Z table). Show all work and provide...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT