Blend will be a cross reference with a one to many relationship This is very simplified but an example of your data could be:
Select * from Wine; +--------+----------+ | WineID | WineName | +--------+----------+ | 1 | XYZ | +--------+----------+ Select * from Grape; +---------+-----------+ | GrapeID | GrapeName | +---------+-----------+ | 1 | GrapeA | | 2 | GrapeB | +---------+-----------+ Select * from Blend; +---------+--------+---------+------------+ | BlendID | WineID | GrapeID | Percentage | +---------+--------+---------+------------+ | 1 | 1 | 1 | 80 | | 2 | 1 | 2 | 20 | +---------+--------+---------+------------+ This is obviuously very simplified, just trying to give you a quick response so you can move ahead in your development without being stuck on this. There might be some disagreement on the naming conventions I have illustrated. Use what you like best. -----Original Message----- From: Colaluca, Brian [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 12:56 PM To: [EMAIL PROTECTED] Subject: MySQL Database Design For instance, let's say that wine XYZ has 80% GrapeA, and 20% GrapeB. Since my grape variety would presumably be a foreign key in the Wine table, how could I specify a certain *percentage* of a foreign key? I've tried hashing this out in numerous ways, including the addition of a "Blend" table with multiple primary keys, but anyway I slice it, there will still be an abundance of NULLs. For while the majority of wines may only contain one grape, there could be wines that have up to 5 or 6 in varying percentages. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php