01.09.2014 Views

Relational Algebra / SQL Practice - Classes

Relational Algebra / SQL Practice - Classes

Relational Algebra / SQL Practice - Classes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Assignment #2 – <strong>Relational</strong> <strong>Algebra</strong>/<strong>SQL</strong><br />

Due: Tuesday, 02/14/12, 11:59pm<br />

Answer the following questions from your Fundamentals of Database Systems<br />

book:<br />

4.10 Specify the following queries in <strong>Relational</strong> <strong>Algebra</strong> and <strong>SQL</strong> on the COMPANY<br />

relational database schema shown in Figure 3.5. Show the result of each query if it is<br />

applied to the COMPANY database in Figure 3.6.<br />

a. Retrieve the names of all employees in department 5 who work more than 10 hours<br />

per week on the ProductX project.<br />

b. List the names of all employees who have a dependent with the same first name as<br />

themselves.<br />

c. Find the names of all employees who are directly supervised by ‘Franklin Wong’.


4.12. Specify the following queries in <strong>Relational</strong> <strong>Algebra</strong> and <strong>SQL</strong> on the database<br />

schema of Figure 1.2.<br />

a. Retrieve the names of all senior students majoring in ‘CS’ (computer science).<br />

b. Retrieve the names of all courses taught by Professor King in 2007 and 2008.<br />

c. For each section taught by Professor King, retrieve the course number, semester,<br />

year, and number of students who took the section.<br />

d. Retrieve the name and transcript of each senior student (Class = 4) majoring in CS. A<br />

transcript includes course name, course number, credit hours, semester, year, and<br />

grade for each course completed by the student.<br />

4.13. Write <strong>SQL</strong> update statements to do the following on the database schema shown<br />

in Figure 1.2.<br />

a. Insert a new student, , in the database.<br />

b. Change the class of student ‘Smith’ to 2.<br />

c. Insert a new course, .<br />

d. Delete the record for the student whose name is ‘Smith’ and whose student number<br />

is 17.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!