The MER (relationship entity model) should be the starting point for you
Elaborate your exercise. Of course, later you will develop your own
Method to be able to accurately map entities, their relationships and transform
Is
With practice, you will realize that it is much easier to view the model in reverse (from the bank to the model and realize the deficiencies).
Instead of answering your question completely and, incidentally, designing it depends a lot on the level you want to reach, we can simplify too much or leave too complete (this is the risk that all modeling runs)I will propose to answer your question in a way that will teach you to reflect on abstraction and modeling. That’s what you need from what I noticed in your question. And it’s not hard.
Come on...
Nouns tend to be Entities in the Model:
Verbs tend to be roles / relationships
Nouns: Book, Author, Publisher
Now let’s think about the verbs to see the relationships between the entities (all in the singular)
Book is CLASSIFIED in Category <<>> Category CLASSIFIES book
Author REDIGE Book <<>> Book is WRITTEN by Author
Translator Translates Book <<>> Book is TRANSLATED by Translator
(But why do we need to think about the proofreading translators etc? Because in a library system the classification considers several data, look at the catalogue of a book).
Editora PUBLICA Livro
Book is PUBLISHED by Publisher
When the book is published, there is an edition! Therefore it is not the Book that is published, but the EDITION of it, which it has, number, date etc.
Now, let’s take a closer look at the relationships
Does the Publishing House actually publish the Book? No, physically the publication is associated with an edition that has print run, edition, date, revision and many other attributes.
Author writes book? How does co-author? And the translator?
Wouldn’t it be better instead to have an Entity called AUTHOR have a so-called person, and it takes on a participation role? Oops! Participation? In what? Participation in the Book.
Then see an example for entities only:
PERSON <<<< PARTICIPATION >>>> BOOK
The rest I’ll leave for you to finish your work ;-)
(Train a lot modeling!)
**Now the pump for you to think: **
BUT WHAT WOULD MY MODEL LOOK LIKE IF IN THE SECOND EDITION THE TRANSLATOR WERE SOMEONE ELSE FROM A PARTICULAR BOOK? By the way, what if we changed the name of the relationship Participation to "Edition"? (now it’s time for you to exercise around :-D)
Hello Emanoel! Welcome to our community. I will prepare an answer and I publish it for you.
– Mateus
Thank you, Matthew! Waiting :D
– emaonel.exe
Your DML does not correspond to the diagram. According to your DML a book is related to 0 or 1 category (same author and publisher). In his diagram a book is related to N categories (same author and publisher). To implement an N:N relationship you need to create an auxiliary table in your physical model, so there should be a Book-Author table that relates each author with all of their books and each book with all of its authors (same category and publisher). Its model predicts that a book may have several publishers?
– anonimo
opa amigo, I edited the cardinalities. would be that way ?
– emaonel.exe
@anonimo forgive me the correction: DDL (Data Definition Language). DML is Manipulation (Manipulation of data, not of structures). Creation of tables is DDL ;-)
– Mateus
@Matthew: right. My fault.
– anonimo
@Manoel: now corresponds to your DDL, it remains to know if it corresponds to reality being modeled, but you have not posted anything that could elucidate this points. For example in the real world a book may have several authors and an author may write several books, it would be a relationship N:N.
– anonimo
In brmodelo (which they ask us to do) there is no relationship N:N, the correct one would be 0:N?
– emaonel.exe
A relationship (A) N:N (B) is translated, in the physical model, into (A) 0:N (A-B) N:0 (B), i.e., an intermediate table is created with the combination of foreign keys. I don’t know this model but you may already have to create these intermediate tables in it.
– anonimo