8
Hypothetically I have a table publicação
that has, by default, attributes autores
(derives from a relationship table),titulo
, edição
, editora
and ano
. However, depending on the type of publication (such as livro
, artigo em periódico
, artigo em jornal
and others) there would be need to collect additional data.
For example, if the publicação
be the type livro
would need to store quantidade de páginas
and volume
. However, a publicação
may be generic and have no type.
My question is: how best to deal with this situation?
I thought of two possible ways:
- Create a table
publicação
with the standard attributes. - Add to
publicação
a columntipo
- Create a table for each possible publication type with its particular attributes
- Relate these new tables to
publicação
and form a composite key
- Create a table
or
- Create a table
publicação
and add all possible attributes of the types and do the treatment in the server-side application. (This does not seem to me a good solution)
- Create a table
I have little experience in databases. I believe there are other solutions. I would like to know which ones?
Thanks for the remark. Actually, use the
id
publication as the primary key in the type tables seems a good alternative to this situation!– Alexandre Thebaldi