Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004

    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.

  2. #2
    Join Date
    Sep 2002

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts