samplemid

# samplemid - 1 UCLA Computer Science Department Fall 2001...

This preview shows pages 1–3. Sign up to view the full content.

1 UCLA Instr: C. Zaniolo Computer Science Department TAs: P. Michael Fall 2001 Student Name and ID: CS143 MIDTERM EXAM: Closed Book, 2 Hours Attach extra pages as needed. Write your name and ID on the extra pages. Please, write neatly. Problem Score 1.1 (20%) 1.2 (15%) 1.3 (15%) 2.1 (10%) 2.2 (20%) 2.3 (10%) 2.4 (10%) Total (100%) Extra Credit: Midterm Score:

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

View Full Document
CS143 Midterm, Fall 2001 — Page: 2 Problem 1 Given a relation describing the courses taken by each student: Student ( StudentID , Course , Grade ) 1. (20 points) Write an SQL query to find the ID of all students who (i) completed at least two classes, and (ii) took a grade of B or better in all classes he/she completed. (Therefore, students who got two As and two Cs would not satisfy this query. Also, the code for grades is numeric and the grade B is denoted by the number 3.0. Finally, you can assume that students only take a course once.) SELECT StudentID FROM Student AS S1 WHERE S1.StudentID NOT IN (SELECT S2.StudentID FROM Student AS S2 WHERE S2.Grade < 3.0) GROUP BY S1.StudentID HAVING count(S1*) >= 2.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern