My university is participating in the implementation of a library borrowing managing system at Richelieu National Library in France.
I received the order to formulate the query: "find all users having borrowed every book" in relational Algebra, in relational Calculus and in SQL (which would probably not happen, probably librarians want to test the limits of the database).
The database has the following pattern (the primary keys are in bold):
Borrowing(People, Book, DateBorrowing, ExpectedReturnDate, EffectiveReturnDate)
Lateness(People, Book, DateBorrowing, LatenessFee)
I tried
$$\Pi_{People}(Borrowing)\div\Pi_{People}(\sigma_{Book} (Borrowing))$$
But It seemed to be wrong as far as to do $r\div s$, $S\subseteq R$ is needed, which seems not to be the case, but why? I'm still talking about people, isn't it?
I then tried the following relational calculus formula:
$$\{t.People|Borrowing(t)\wedge(\forall u Borrowing(u)\Rightarrow t.DateBorrowing)\}$$
To find every books that have a borrowing date. I know this calcuation is false but I don't know how to do better...
Then in SQL:
SELECT People FROM Borrowing
WHERE FORALL Books EXISTS DateBorrowing
That is what I tried and I know that is not the right way to "find all users having borrowed every book". Can you help me expressing correctely such a querry?