Re: design
От | Adam Lang |
---|---|
Тема | Re: design |
Дата | |
Msg-id | 004c01c0894d$f54375e0$330a0a0a@6014cwpza006 обсуждение исходный текст |
Ответ на | Re: design ("Brett W. McCoy" <bmccoy@chapelperilous.net>) |
Список | pgsql-general |
Plus, it allows you to add more functionality later. Say you later want to keep track of phone numbers. Add another table with a phone number field linked to the master table with the users instead of making your one table consistently larger. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Brett W. McCoy" <bmccoy@chapelperilous.net> To: "Jeff" <jeff4e@rochester.rr.com> Cc: <pgsql-general@postgresql.org> Sent: Tuesday, January 30, 2001 11:51 AM Subject: Re: [GENERAL] design > On Tue, 30 Jan 2001, Jeff wrote: > > > I have a design question. Lets say we want to keep track of users and > > their respective snail mail addresses. Each user can have up to 4 > > different mailing address. Is it better to have all this information in > > one table. Or is it better to have a user table and an address table, > > and have the user id as a foreign key in the address table? > > I would put the addresses in a separate table and use the foreign key. > That way each user can have as many addresses as you want. A year from > now you might change your requirement to 5 addresses. Or perhaps you want > to keep historical information. > > In general, if you find yourself designing a table where duplicate > information is showing up (in this case, if you had only used one table, > user names would have been entered 4 times, once for each address), you > need to apply normalization and break it into two (or more) tables. > > -- Brett > http://www.chapelperilous.net/~bmccoy/ > -------------------------------------------------------------------------- - > Health is merely the slowest possible rate at which one can die.
В списке pgsql-general по дате отправления: