csc4402_home2_ans_06

# csc4402_home2_ans_06 - Answer Key to CSC4402 Homework 2 Due...

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
This is the end of the preview. Sign up to access the rest of the 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

{[ snackBarMessage ]}

### Page1 / 2

csc4402_home2_ans_06 - Answer Key to CSC4402 Homework 2 Due...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online