L
L
LordPrimes2018-03-13 20:03:16
MySQL
LordPrimes, 2018-03-13 20:03:16

How to build a database?

Good afternoon. I was thinking about how to sort by product categories, and I realized one thing if there is one product, then it’s easy to think through everything, but if it’s different and there are a lot of them, then there are a lot of ideas, and therefore I would like to ask how best to do it, for example, there are TVs and video cards in one table is not realistic to shove because the buyer wants to choose a TV by matrix and a video card by frequency or power.
And that's the whole point. I correctly understood that it's better to make a different table for different products, for example, the user clicks on the TVs section and the following query will be executed $ sql = "SELECT telek * FROM " and then when he clicks on the button for the $ sql = matrices " SELECET telek * FROM WHERE matr ='some matrix' "; and so on to all kinds of goods.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2018-03-13
@Sanasol

https://en.wikipedia.org/wiki/Entity%E2%80%93attri...
https://en.wikipedia.org/wiki/Faceted_search

T
ThunderCat, 2018-03-14
@ThunderCat

I correctly understood that it is better to make different tables for different products

No, not right.
There are a lot of options for storage and selection with this type of relationship, all of them have their advantages and disadvantages, but none of them use the storage of attributes in a "flat" table. Alexander Aksentiev gave you a couple of links to variants of entity relationships, but there are much more of them in nature. Look for the one that suits you best.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question