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

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

View Full Document Right Arrow Icon
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:
Image of page 1

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

View Full Document Right Arrow Icon
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.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern