{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

midsample1 - 1 UCLA Computer Science Department Fall x...

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

View Full Document Right Arrow Icon
1 UCLA Instr: C. Zaniolo Computer Science Department TAs: Fall x Your Name and ID: CS143 MIDTERM EXAM: Closed Book, 100 minutes. Please Read: Attach extra pages as needed. Write your name and ID on the extra pages. If you need to make any assumptions to solve a problem, please write you assumptions clearly in your answer. Simplicity and clarity of your solutions will count. You may get as few as 0 point for a problem if your solution is far more complicated than necessary, or if we cannot understand your solution. Please write neatly. Problem Score 1 (28%) 2 (20%) 3 (24%) 4 (28%) Total (100%) Extra Credit: Midterm Score:
Image of page 1

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

View Full Document Right Arrow Icon
CS143 Midterm, Fall 2006 — Page: 2 Problem 1: 28 points Given a relation describing the courses taken by each student during the last four years: Student ( StudentID , Course , Quarter , Grade ) Write an SQL query to find the ID of all students who (i) have a GPA > 3 . 5 (the GPA is computed from the courses listed in the relation), and (ii) never received the worst grade in any of the classes they took. Assume that students never repeat classes and Grade is in numeric form. (e.g., 3.0 for B). Answer: Several solutions are possible. Here is one: select StudentID from Student where StudentID not in (select StudentID, from Student where (Course, Quarter, Grade) in (select Course, Quarter, min(grade) from Student group by Course, Quarter)) having avg(Grade) > 3.5 group by StudentID Here is Another : select StudentID from Student having avg(Grade) > 3.5 group by StudentID EXCEPT select StudentID, from Student where (Course, Quarter, Grade) in (select Course, Quarter, min(grade) from Student group by Course, Quarter))
Image of page 2
CS143 Midterm, Fall 2006 — Page: 3 Problem 2: 20 points
Image of page 3

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

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