Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Expert Solution & Answer
Book Icon
Chapter 11, Problem 1PE

Explanation of Solution

Query

 create view student_grades (ID,GPA) as

     select ID, credit_points / decode (credit_sum, 0, NULL, credit_sum)

     from ((select ID, sum(decode(grade,NULL,0,credits)) as credit_sum,

         sum(decode(grade,NULL,0,credits*points)) as credit_sum

         from(takes natural join course) natural left outer join grade_points

         group by ID)

     union

 select ID, NULL

 from student

 where ID not in (select ID from takes))

Explanation

  • The credits for course with a null grade should not be added to handle the case where a student has not completed any course.
  • The query can be broken down into a sub query that finds sum of credits and sum of credit grade points.
  • Here view takes care of NULL grades by considering the credit points to be 0.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
After our initial deployment for our ML home based security system, the first steps we took to contribute further to the project, we conducted load testing, tested and optimize for low latency, and automated user onboarding. What should be next?
Why investing in skills and technology is a critical factor in the financial management aspect of system projects.
why investing in skills and technology is a critical factor in the financial management aspect of systems projects.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education