Hello. We are working from Practical Guide to Using SQL in Oracle Chapter 6 Set
ID: 3855046 • Letter: H
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 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 A’s and B’s 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 A’s or B’s 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 difference—show (set A minus set B) and (set B minus set A). Look at the original queries, Q65a and Q65b, to verify your result.
Explanation / Answer
-> This quert will show you (set A minus set B):
select studentnmbers from setA
minus
select studentnumbers from setB;
-> this query will show you Set B minus Set A:
select studentnmbers from setB
minus
select studentnumbers from setA;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.