E
E
Evgeny Vlasov2016-11-23 19:14:37
SQL
Evgeny Vlasov, 2016-11-23 19:14:37

How to properly organize the database structure for price lists?

Hello! They gave me a task at the university on databases.
fb82292d69254d2fb56af50236d14bb7.jpg9d3c38d7f99941118bf5f1d0b7848767.jpg
The organization of structure of a DB interests.
So far, I'm guessing 2 options:
We make separate tables for PC components and store only the characteristics there.

  1. We make one price list table with the fields: store id, id of the component PC, price (but there is a problem that the id field of the component cannot be made a foreign key, because the choice of a third-party table depends on the type of component (video card / CPU, etc.))
  2. We make our own price list table for each component table (i.e. a separate price list for video cards, CPUs, etc.) with the following fields: store id, component PC id, price. (Here there will be no problem with foreign key, but there will be many tables)
Question : how to do it right? Maybe not in any of the above ways. Thank you.
8d57bd351d4b4c59b57318145688cb08.png
----
I am attaching a photo of the task and the current database diagram.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2016-11-23
@sim3x

Get used to the fact that in the IRL there is no correct one - there are those who solve the problem, and those that produce crutches
Yours is closer to the second
Company:
- name
Product:
- name
- type (sdrom, CPU, frame, ...) can be made a static list, you can make FC on a separate table
- .... other characteristics common to all Commodity Price
:
- company = FC (Company)
- price
Individual characteristics for each product are done according to https://en.wikipedia.org/wiki/Entity%E2%80 %93attri...

V
vjjvr, 2016-11-23
@vjjvr

The biggest problem is product matching.
Different companies use different names.
Only humans can compare.
How will the data be collected?
If they are loaded automatically, then you need to store data on the comparison of identical products somewhere else.
If they are hammered in manually, then everything is easier - you can immediately score in the same way.
For such things, I would not use tables - "video cards", "memory", etc.
It will be difficult to expand.
I in schemaless DBMS would make. For example, in MongoDB.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question