Afficher un message
Vieux 23/09/2007, 09h22   #1
-Lost
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Trying to wrap my brain around a normalization issue. Assistance please?

OK folks, please bear in mind I am a casual MySQL user, but not
novice (at least I don't think so, I could be wrong). Anyway, I am
trying to understand the best way to implement this schema.

Let's say the database is going to store fruit. Each fruit can also
contain another fruit.

So, without repeating and if I understand normalization correctly, I
need 1 table to contain fruits and a fruit_id. Another table would
contain fruit_id, and <I am lost at this point>. I understand the
need to not repeat data, but I cannot seem to understand the logic
behind it.

How can I possibly store fruits that may contain other fruits,
without repeating data such as the fruits themselves?

For example:

table: fruits
id: 1
fruit: grapes
fruit_id: g1

id: 2
fruit: apples
fruit_id: a1

table: associated_fruits
id: 1
-- failure of 1NF (or is it?) if I put the fruit name here
?: ?
fid: a1, g1

So SOMETHING along these lines. I think I do not have enough
experience to look at this without blurring the lines. I cannot see
the woods because of the trees, so to speak.

I also may not understand the first normal form. I am thinking 1NF
pertains to one table, not 2 or more. Thereby my 2nd table *could*
contain the fruit. Is this right?

Sorry, if I explained this poorly, I have difficulties when it comes
to logistics.

Any ideas?

Thanks!

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
  Réponse avec citation
 
Page generated in 0,05884 seconds with 9 queries