Re: [GENERAL] Data model question regarding usage of arrays.

2006-03-27 Thread David Fetter
On Mon, Mar 27, 2006 at 05:08:58PM -0800, Ricebot wrote: > Wait, nm, > > no need for uid_bridge in recipes Sure there is. If one recipe can contain several ingredients and an ingredient can be in more than one recipe, you need that join table :) Cheers, D (who isn't going to try to design a coo

Re: [GENERAL] Data model question regarding usage of arrays.

2006-03-27 Thread Ricebot
Wait, nm, no need for uid_bridge in recipes ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Data model question regarding usage of arrays.

2006-03-27 Thread Ricebot
Solution CREATE TABLE ingredients ( uid integer, ... -- nutritional info ) CREATE TABLE recipes ( uid integer, uid_bridge integer -- uids in bridge table ) CREATE TABLE bridge ( uid integer, uid_ingredients integer -- uids in table ingredients ) rows in recipes table can

[GENERAL] Data model question regarding usage of arrays.

2006-03-27 Thread Ricebot
Hi, I'm looking at a very simple database that contains a table of recipes and a table of ingredients with nutritional content. I'd defined the schema as such CREATE TABLE ingredients ( uid integer, ... -- nutritional info ) CREATE TABLE recipes ( uid integer, ingredients inte