{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Tuple relational calculus elname efname employeee and

Info icon This preview shows pages 6–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Tuple relational Calculus:
Image of page 6

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
{ e.LNAME, e.FNAME | EMPLOYEE(e) AND (FORALL p) ( NOT(PROJECT(p)) OR (EXISTS w) ( WORKS_ON(w) AND p.PNUMBER=w.PNO AND w.ESSN=e.SSN ) ) } Domain relational Calculus: { qs | (EXISTS t) ( EMPLOYEE(qrstuvwxyz) AND (FORALL b) ( NOT(PROJECT(abcd)) OR (EXISTS e) (EXISTS f) (WORKS_ON(efg) AND e=t AND f=b) ) } (f) Retrieve the names of employees who do not work on any project. Tuple relational Calculus: { e.LNAME, e.FNAME | EMPLOYEE(e) AND NOT(EXISTS w) ( WORKS_ON(w) AND w.ESSN=e.SSN ) } Domain relational Calculus: { qs | (EXISTS t) ( EMPLOYEE(qrstuvwxyz) AND NOT(EXISTS a) ( WORKS_ON(abc) AND a=t ) ) } (i) Find the names and addresses of employees who work on at least one project located in Houston but whose department has no location in Houston. Tuple relational Calculus: { e.LNAME, e.FNAME, e.ADDRESS | EMPLOYEE(e) AND (EXISTS p) (EXISTS w) ( WORKS_ON(w) AND PROJECT(p) AND e.SSN=w.ESSN AND w.PNO=p.PNUMBER AND p.PLOCATION='Houston' AND NOT(EXISTS l) ( DEPT_LOCATIONS(l) AND e.DNO=l.DNUMBER AND l.DLOCATION='Houston' ) ) } Domain relational Calculus: { qsv | (EXISTS t) (EXISTS z) ( EMPLOYEE(qrstuvwxyz) AND (EXISTS b) (EXISTS c) (EXISTS e) (EXISTS f) ( WORKS_ON(efg) AND PROJECT(abcd) AND t=e AND f=b AND c='Houston' AND NOT(EXISTS h) NOT(EXISTS i) ( DEPT_LOCATIONS(hi) AND z=h AND i='Houston' ) ) } (j) List the last names of department managers who have no dependents. Tuple relational Calculus: { e.LNAME | EMPLOYEE(e) AND (EXISTS d) ( DEPARTMENT(d) AND e.SSN=d.MGRSSN AND NOT(EXISTS x) (DEPENDENT(x) AND e.SSN=x.ESSN) ) } Domain relational Calculus: { s | (EXISTS t) ( EMPLOYEE(qrstuvwxyz) AND (EXISTS c) ( DEPARTMENT(abcd) AND t=c AND NOT(EXISTS e) (DEPENDENT(efghi) AND e=t) ) } 6.25 No solution provided.
Image of page 7
6.26 Specify queries of Exercise 6.18 in both the tuple relational calculus and the domain relational calculus. Also specify these queries in the relational algebra. Answer: We will only do tuple and domain relational calculus here. (a) Retrieve the names of all senior students majoring in 'COSC' (computer science). Tuple relational Calculus : { s.Name | STUDENT(s) AND AND s.Class=5 AND s.Major='COSC' } Domain relational Calculus: { a | (EXISTS c) (EXISTS d) ( STUDENT(abcd) AND c=5 AND d='COSC' ) } (b) Retrieve the names of all courses taught by professor King in 85 and 86. Tuple relational Calculus: { c.CourseName | COURSE(c) AND (EXISTS s) ( SECTION(s) AND c.CourseNumber=s.CourseNumber AND s.Instructor='King' AND ( s.Year='85' OR s.Year='86' ) ) } Domain relational Calculus: { a | (EXISTS b) (EXISTS f) (EXISTS h) (EXISTS i) ( COURSE(abcd) AND SECTION(efghi) AND f=b AND i='King' AND ( h='85' OR h='86' ) ) } (c) For each section taught by professor King, retrieve the course number, semester, year, and number of students who took the section. This query cannot be done in basic relational calculus as it requires a COUNT function. (d) Retrieve the name and transcript of each senior student (Class=5) majoring in COSC. Transcript includes course name, course number, credit hours, semester, year, and grade for each course completed by the student. Tuple relational Calculus: {s.Name, c.CourseName, c.CourseNumber, c.CreditHours, t.Semester, t.Year, g.Grade | STUDENT(s) AND COURSE(c) AND SECTION(t) AND GRADE_REPORT(g) AND s.Class=5 AND s.Major='COSC' AND s.StudentNumber=g.StudentNumber AND g.SectionIdentifier=t.SectionIdentifier AND t.CourseNumber=c.CourseNumber} Domain relational Calculus: {aefgklp | (EXISTS b) (EXISTS c) (EXISTS d) (EXISTS n) (EXISTS o) (EXISTS j) (EXISTS i) (STUDENT(abcd) AND COURSE(efgh) AND SECTION(ijklm) AND GRADE_REPORT(nop) AND c=5 AND d='COSC' AND b=n AND i=o AND j=f)} (e) Retrieve the names and major departments of all straight A students (students who have a grade of A in all their courses).
Image of page 8

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern