(Microsoft Access SQL) I am trying to answer a question with the correct query.
ID: 3757051 • Letter: #
Question
(Microsoft Access SQL) I am trying to answer a question with the correct query. I am just not sure if the output of C5, C6, C2, C3, C7 is correct. I thought it should be C1 and C4. I am trying to find the answer to "Get CNum for consoles that have a minnimum of all the game played by user U10"
SELECT C.CNum
FROM Consoles AS C
WHERE C.CNum NOT IN
(SELECT P.CNum
FROM Plays AS P
WHERE P.UNum IN
(SELECT U.UNum
FROM Users AS U
WHERE U.UNum = "U10"))
Explanation / Answer
If you have any doubts, please give me comment...
SELECT C.CNum
FROM Consoles AS C
WHERE NOT EXISTS(
SELECT *
FROM Users U
WHERE U.UNum = 'U10' AND NOT EXISTS(
SELECT Plays
FROM Plays P
WHERE P.CNum = C.CNum AND P.UNum = U.UNum
)
);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.