HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Per person weighted answers

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
answersweightedpersonper

Problem

Hi I'm new to database design but am trying to make sure I get things right first time so as not to pick up bad habits.
My question is I have a set of people for which I want to record needs mapped to importance.
Needs should be taken from a set to avoid duplicates creeping in. Each person will take a subset of these and grade their importance.
i.e.
needs =[tea, biscuits, toilet facilities, internet access]
People = [Phil, Bryan]

Phil needs tea and biscuits, tea with an importance of 10 biscuits with an importance of 3.

Bryan needs internet access and biscuits with importance of 4 and 7 respectively.

How would you suggest organizing the tables to implement this.
Thanks

Solution

What you need is a design like this:

Keep you list of people in one table. Then keep another table with the list of things that various people might need. Normalizing people and needed things is important for being able to write simple, reliable queries about your data from the perspective of either an individual person or a particular needed thing.

Use a third table to keep track of who needs what, and how badly they need it.

Context

StackExchange Database Administrators Q#22331, answer score: 4

Revisions (0)

No revisions yet.