Hw2_Sol - 1. (25 points)Specify the following queries in...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1. (25 points)Specify the following queries in SQL on the database schema of Figure 1.2. a. Retrieve the names of all students who study in class 1. SELECT Name FROM STUDENT WHERE Class=1 b. Retrieve the names of all courses taught by professor Anderson in 07 and 08. SELECT Course_name FROM COURSE WHERE Course_number IN (SELECT Course_number FROM SECTION WHERE Instructor=’Anderson’ AND (Year=’07’ OR Year=’08’)) c. For each section taught by professor Stone, retrieve the course number, year, and number of students who took the section. SELECT Course_number, Year, COUNT (*) FROM SECTION, GRADE_REPORT WHERE Instructor='Stone’ AND SECTION.Section_identifier=GRADE_REPORT.Section_identifier GROUP BY Course_number, Year d. Retrieve the section identifier and corresponding grade taken by student named Brown. SELECT GRADE_REPORT.Section_identifier, GRADE_REPORT.Grade FROM STUDENT, GRADE_REPORT WHERE STUDENT.Name=’Brown’ AND STUDENT.Student_number=GRADE_REPORT.Student_number e. Retrieve the total credit hours taken by the student whose name is ‘Brown’ and student number is 8. SELECT SUM(Credit_hours) FROM STUDENT ST, COURSE C, SECTION S, GRADE_REPORT G WHERE ST.Name=’Brown’ AND ST.Student_nmber=8 AND ST.Student_number =G.Student_number AND G.Section_identifier=S.Section_identifier AND S.Course_number=C.Course_number 2. (20 points)Write SQL update statements to do the following on the database schema shown in Figure 1.2.(Ignore the relatively constraint) a. Insert two new student <’ppinky’, 35, 1, 'MIS'>, <’chen0394’, 36, 2, 'MIS'> in the database
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/05/2012 for the course IM 100 taught by Professor Ccc during the Spring '11 term at National Taipei University.

Page1 / 5

Hw2_Sol - 1. (25 points)Specify the following queries in...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online