This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Answer Key to CSC4402 Homework 2 Due Wednesday 9-20-2006 A. Write Relational Algebra expressions (not SQL) for the following queries with respect to the data- base below (primary key attributes are boldfaced and underlined : D: ( DEPT DNAME BUDGET) for departments T: ( T # TNAME CITY DEPT) for teachers S: ( S # SNAME CITY DEPT DEGREE) for students C: ( C # CNAME DEPT T#) for courses E: ( S # C # GRADE) for enrollments Note: Here ECE , MATH , CSC are values of the attribute "DEPT" rather than "DNAME". (A.1) Get S#, SNAME for New Orleans students from CSC department. Answer: S #, SNAME ( CITY = New Orleans DEPT = CS C ( S )) (A.2) Get C#, Cname for courses which are taken by a student from CSC department. Note: here I am using the word "JOIN" to denote the natural join operator. R 1 E JOIN ( DEPT = CS C ( S )) JOIN ( C #, CNAME ( C )) result = C #, CNAME ( R 1 ) (A.3) Get S# for students who are either from...
View Full Document
- Fall '11