Re: Bad database design can cause unnecessary coding [message #179651 is a reply to message #179641] |
Thu, 15 November 2012 18:03 |
Peter H. Coffin
Messages: 245 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Thu, 15 Nov 2012 15:49:46 +0100, Erwin Moller wrote:
> The only times I don't use a SERIAL is when storing many-to-many
> relationships.
> For example, when you store many-to-many relationships in a coupletable
> (not sure if that is the right word):
> eg, a table that links users to their favorite food:
> CREATE TABLE tbluserfavfood(
> userid integer references tbluser(userid),
> favfoodid integer references tblfavfood(favfoodid)
> )
Terms common for this are map table, junction table, and intersection
table. There are others, but these three are the most common among
people I work with.
--
The true sysadmin does not adjust his behaviour to fit the machine. He
adjusts the machine until it behaves properly. With a hammer, if necessary.
- Brian in the Monastery
|
|
|