Modeling Categories and Subcategories

Asked

Viewed 919 times

3

I am modeling a database related to e-commerce and I have a question in the modeling of the tables of categories and subcategories of products.

At first I created two tables one of Categoria and another of Subcategoria. However, I found a article where the author says it is not necessary to create two tables. What it does basically is in the same table include the category code in the record which will be a subcategory.

What are the advantages of making a model with two tables or only one, as mentioned in the article?

  • See if anything helps here http://answall.com/search?tab=votes&q=categoria%20subcategory

  • 1

    I’ve worked with both models but I haven’t seen many differences between two or a table. The only good thing about using only one was to mount treeview

1 answer

3

It is not necessary. The difference is between the data standardisation and the denormalization of data.

Standardisation aims to avoid information redundancy and give more consistency to data.

Denormalization, on the other hand, aims for better performance (since, in some situations, a high normalization can cause high performance costs).

Choosing between one or the other, or even using a little of each, depends on each project (including amount of records, hardware available, number of users, etc.).

Recommendation of a great professional in the field of databases:

"Normalize until it hurts, denormalize until it works!"

Jason Couchman, author of the book: "Oracle 8 Certified Professional DBA Certification Exam Guide"

There are several articles on the internet on the subject!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.