It's UWAweek 47

help1402

This forum is provided to promote discussion amongst students enrolled in CITS1402 Relational Database Management Systems.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 2 articles in this topic
Showing 2 of 684 articles.
Currently 121 other people reading this forum.


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍x1
helpful
2:16pm Sat 14th Sep, ANONYMOUS

According to the hint: "Hint use UNION then an EXCEPT operation." But why? Because the table bookjobs has both cust_id and jobtype, we just need to use EXCEPT like this: SELECT cust_id FROM bookjobs WHERE jobtype IN ('R', 'H') EXCEPT SELECT cust_id FROM bookjobs WHERE jobtype = 'N'; If we use UNION, it should be something like this: SELECT cust_id FROM bookjobs WHERE jobtype = 'R' UNION SELECT cust_id FROM bookjobs WHERE jobtype = 'H' EXCEPT SELECT cust_id FROM bookjobs WHERE jobtype = 'N'; Am I correct or using a wrong database? Thanks.


SVG not supported

Login to reply

👍x1
helpful
8:08pm Sat 14th Sep, Mengxi L.

You are correct in using EXCEPT with IN, as it achieves the same goal. The hint suggests using UNION likely for clarity or to explicitly combine job types 'R' and 'H' before filtering. It is simply an exercise in using UNION, but both approaches should yield the same result in this case.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy