Note that there are some explanatory texts on larger screens.

plurals
  1. PODerby database query
    text
    copied!<p>I'm working on a calendar system. We are using Derby. I'm writing a script to ask (in my opinion) a very hard logic statement. I have been reading in derbys instructions but cant seem to find some instruction. I have used 'Antijoin' when I made the logic and it seems derby dose not support this. To my question. In the picture below. What would that statement be? It would suck to change the database tables because Derby dose not support 'Antijoin' because we have made so many other queries. Im sorry it is not written in English but the signs are international. I'm also comparing some variables from the script. The logic works as it is there it's just I am having a hard time to write it in Derby sql.</p> <p>In the picture there are the relations. I don't have to use antijoin but cant get my head around another way to solve it.</p> <p><img src="https://i.stack.imgur.com/SvW1e.jpg" alt="enter image description here"></p> <p><strong>EDIT:</strong> There was a question to not use the picture so i will explain. It's now in english so if you see different names on the pictures i translated it.</p> <p>There are two tables involved.</p> <p>Room</p> <p>roomName numberOfPeople description</p> <p>Meeting</p> <p>(There is more here but i will only write what is important) roomName meetingStart meetingEnd</p> <p>The query is to find witch rooms are available too use for the meeting.</p> <p>What I have designed is that I will select from the meeting table only the meetings that are conflicting with the new reservation of the room your are trying to make. You cant do it the other way around in my opinion. It looks like this: reservationStart > meetingStart AND meetingEnd > reservationEnd</p> <p>Then i will 'antijoin' with the lists of all the rooms. This will make a list of all the available rooms. The problem is that it seems Derby cant antijoin. Is there another way to construct a antijoin with other joins? Hope you understand what I'm writing </p> <p><strong>EDIT2:</strong></p> <p>I'mnot getting any error because I have not tried any queries. I have been working on making the query and what i got thus far is this:</p> <pre><code>SELECT roomName, numberOfPeople, description FROM ROOM WHERE roomName NOT IN (SELECT roomName, meetingStart, meetingEnd FROM Meeting WHERE reservationEnd &gt; meetingStart AND meetingEnd &gt; reservationStart); </code></pre> <p>But from what i have been reading there is no 'NOT IN' in Derby. How can I rephrase the query?</p> <p><strong>EDIT 3:</strong></p> <p>I have got the query. The error code I'm getting now is this:</p> <p>ERROR 42X39: Subquery is only allowed to return a single column.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload