DATABASE SYSTEM CONCEPTS LCPO
7th Edition
ISBN: 9781265586577
Author: SILBERSCHATZ
Publisher: MCG
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
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!
Chapter 11 Solutions
DATABASE SYSTEM CONCEPTS LCPO
Knowledge Booster
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education