I am trying to build a Drupal 10 site that has a library of books with poems. Each book has a title, ISBN and other data and a list of the poems included in the book. The list shows the title and the page number of each poem. So far I can create a Content type Book with additional fields and a Content type Poem with additional fields. In the Book type I can create an Entity Reference to Poem.
However, a poem can be published in multiple books and in each book it has a different page number.
If the user selects a poem it should see a list of books it appears in with the page number in the respective book.
I have the information in a SQL database, a table for Book, a table for Poem and a table for PoemInBook.
What is the best way to create these relationships in a Drupal site?