Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: "Peter H. Coffin" Newsgroups: comp.lang.php Subject: Re: Bad database design can cause unnecessary coding Date: Thu, 15 Nov 2012 12:03:23 -0600 Organization: A noiseless patient Spider Lines: 19 Message-ID: References: <50a50110$0$6882$e4fe514c@news2.news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="95eff61b8f8136989e561408eae2762f"; logging-data="27264"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/o+Urnr+FToZ2f/PsaQewM" User-Agent: slrn/0.9.9p1 (OpenBSD) Cancel-Lock: sha1:Tez6DNrXQR9Xr3KHS73XnyMBPEE= Xref: csiph.com comp.lang.php:7582 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