Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
There are one-one relationship between room and application means an application must occupy a room. If I want to get the room that doesn't occupied by application, how to write sql to query
select * from room r where not exists (select 1 from application a where a.roomId = r.roomId)
OR
select * from room r left outer join application a on r.roomId = a.roomId where a.roomId is null
Add a comment
try this
SELECT roomID,description FROM room WHERE roomID NOT IN ( SELECT roomID from application )
Algorithm:
The difference between those is the rooms which are not used by any of the applications
select roomID from room where roomID not in (select roomID from application)
should do the trick.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.