Question: Hello. We are working from Practical Guide to Using SQL in Oracle Chapter 6 Set Operations.I need help on part C. A less obvious example
Hello. We are working from Practical Guide to Using SQL in Oracle Chapter 6 Set Operations.I need help on part C.
A less obvious example of a difference query would be to find a difference that is not based on simple, easy-to-get sets. Suppose that set A is the set of students who have earned As and Bs in computer science (COSC) courses. Suppose further that set B is the set of students who have taken math courses (regardless of what grade they earned).
Then, set A minus set B would contain names of students who have earned As or Bs in computer science courses, less those who have taken math courses. Similarly, set B minus set A would be the set of students who took math courses, less those who took COSC courses and earned an A or a B in COSCxxxx.
Build these queries into set difference queries as views based on student numbers and execute them.
a. First, run a query that gives the student number, name, course, and grade for each set. Save each query as Q65a and Q65b.
b. After saving each query, reconstruct it into a view of just student numbers, verify that it works, and then use create view to create set A and set B. Verify that you have the same number of tuples in set A as you have in Q65a and in set B as in Q65b.
c. Then, display the student numbers of students in each set differenceshow (set A minus set B) and (set B minus set A). Look at the original queries, Q65a and Q65b, to verify your result.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
