Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1686

Re: More about relationship in a database

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 <esquel@sommarskog.se>
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 <XnsA2D6C885F7C41Yazorman@127.0.0.1> (permalink)
References <ldqsci$ths$1@dont-email.me>
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

Show key headers only | View raw


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

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Find similar


Thread

More about relationship in a database "Tony Johansson" <johansson.andersson@telia.com> - 2014-02-16 18:26 +0100
  Re: More about relationship in a database Erland Sommarskog <esquel@sommarskog.se> - 2014-02-16 19:42 +0100

csiph-web