0
$\begingroup$

I want to create a database and model it with an E-R diagram. This database should be about a library. An entity is the member of the library, where the member can borrow books from the library. However , the member cannot borrow more than 5 books and cannot borrow any more books , if he hasn't returned every book of which the time to return it has expired. Ιs it possible to model this condition with an E-R diagram?

$\endgroup$
3
  • 1
    $\begingroup$ Such conditions cannot be modeled with classical E-R diagrams, that represent structural aspects of the model, but must be expressed as integrity constraints accompanying it. $\endgroup$ – Renzo Apr 2 '19 at 9:04
  • $\begingroup$ @Renzo how would you do that? $\endgroup$ – user102382 Apr 2 '19 at 9:12
  • $\begingroup$ As the comment of Koenig Lear suggests, you can use the UML methodology and tools. $\endgroup$ – Renzo Apr 2 '19 at 12:49
1
$\begingroup$

This can be expressed in a one to many relationship with a 0..5 end:

LibraryPatron 1 <----> 0..5 BorrowedBook

Using relational algebra they can be expressed using check constraints as Renzo suggested. Some ER tools may also allow you to express this as a constraint.

$\endgroup$
2
  • $\begingroup$ If I can only use 1:N , N:M and 1:1 , what would you suggest? $\endgroup$ – user102382 Apr 2 '19 at 11:55
  • $\begingroup$ @maverick98 you could use UML notation $\endgroup$ – Koenig Lear Apr 2 '19 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy