Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: More about relationship in a database Date: Sun, 16 Feb 2014 19:42:44 +0100 Organization: Erland Sommarskog Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx05.eternal-september.org; posting-host="fd3d6d0229f14a752f017d8f9903addd"; logging-data="27634"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pytQwRHS+nF3xQUtQVCMM" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:ShZ5WZ3oBNII5JxtiCoJuHRfV04= Xref: csiph.com comp.databases.ms-sqlserver:1686 Tony Johansson (johansson.andersson@telia.com) writes: > Assume I have a table in the database called Inventory. > Now what is a resonable design type between Inventory and Product. > Where should the foreign key be placed ? That depends on what's in these tables. If a given product can be associated with one given invetory at a time, the InventoryId would be a foreign-key column in the Products table. On the other hand, if the Inventory table contains something like the stock of all products at all warehouses, the ProductId column would be a foreign- key column in Inventory. -- Erland Sommarskog, Stockholm, esquel@sommarskog.se