If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Two relationships between two tables?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-19-04, 11:24
kyler kyler is offline
Registered User
 
Join Date: Feb 2004
Location: NY
Posts: 1
Question Two relationships between two tables?

I am working on an asset inventory database for computers, monitors, printers, etc. PCs and printers each have their own table, but I would like to have a relationship between the PC and printer tables for PCs with a local printer.

This leads me to question if I should have a field in the PC table for the local printer ID, a field in the printer table for attached PC ID, or both. Unfortunately, since not many PCs have a local printer, there would be a lot of nulls in the field in either table. However, it would be nice to easily list local printers (without searching the printer table) on a query of PCs. It would also be nice to easily identify an attached PC (without searching the PC table) on a query of printers.

What are the thoughts on this? Would it be better to create two relationships, or only one? If one, which one? Thanks.
Reply With Quote
  #2 (permalink)  
Old 02-19-04, 12:00
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Two relationships between two tables?

How about adding another table for the printer/pc relationship? This would also allow you to track movement of printers, e.g.:

PHP Code:
select from printer_pc where printer_id 123;

printer_id  pc_id     from         to
----------  --------  -----------  -----------
123         ABC1      01-Jan-2001  14-Jul-2003
123         DEF4      15
-Jul-2003 
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On