1
I need to make a library system for book loans, in which I drew up this database diagram. The professor said that this diagram is inconsistent. What needs to be done, it’s just these tables that I’m really going to need?
1
I need to make a library system for book loans, in which I drew up this database diagram. The professor said that this diagram is inconsistent. What needs to be done, it’s just these tables that I’m really going to need?
4
When modeling tables in a relational database should begin by trying not to repeat the information in different tables by making use of the relations.
For example there is a table t_alunos_has_t_emprestimos
that seems to serve to relate loans with students and at the same time with books. But the information of the student seems to already exist in the table t_emprestimos
.
I would advise the following process:
Alunos
, Emprestimos
and Livros
. However, depending on the requirements you may decide to add more entities. For example, imagine the case where a Student has more than one contact. Maybe it makes sense to add an entity Contacto
. The decision is yours.nome
for the entity Aluno
. Or titulo
, ano
, isbn
for the entity Livros
.Emprestimo
is related only to a Aluno
, is a "one to many" relation. You must put a field aluno
on the table Emprestimo
.Emprestimo
may contain several Livros
. It is a "many to many" relation. This type of relation requires a new table. You must define a table (pivot) that contains the relation between Emprestimo
and Livro
.Read more about database normalization. You can find some information about "Normal Forms" here or, if you feel comfortable with English, here. Try to follow the Third Normal Form.
It’s hard to help otherwise because it all depends on your requirements.
Browser other questions tagged sql-server modeling database
You are not signed in. Login or sign up in order to post.
t_loan can not repeat fields, cd_Aluno already has in the relationship table so pq it is there? this is an example of inconsistency.
– Dorathoto