我有一个小任务:找到那些有投影仪但没有白板的房间。
CREATE TABLE Equipment
(
room VARCHAR(15),
type VARCHAR(20)
);
INSERT INTO Equipment VALUES ('Dreyer-201','projector');
INSERT INTO Equipment VALUES **('Zuse-127','projector');**
INSERT INTO Equipment VALUES ('Shannon-164','projector');
INSERT INTO Equipment VALUES ('Dreyer-201','whiteboard');
INSERT INTO Equipment VALUES **('Zuse-127','whiteboard');**
INSERT INTO Equipment VALUES ('Shannon-164','whiteboard');
这是我的回答:
SELECT DISTINCT room, type
FROM Equipment
WHERE type = 'projector' AND NOT type = 'whiteboard'
它正在工作 - 但我的输出列出了房间 Zuse-127。我知道它独立于投影仪和白板,但我该如何解决这个问题?所以房间 Zuse-127 没有显示。