0

Question about subtables

First, let me say that although I understand various relational database concepts, I'm a long way from being an expert user. There is no such thing as oversimplification when describing something to me!

I've got a db for a bunch of prescription meds. I've got 2 tables, 1 for the basic info on each Rx and 1 for purchases. The 2nd table is because the particulars may change (which pharmacy, cost, etc). I'd like to look at a page that shows all the info for a particular drug, plus an embedded table of the purchase records as a purchase history. 

My question is, should I make a separate subtable for each Rx, or can the purchase records all go in one table and then there's some way to find each record's way to the right Rx? 

1 reply

null
    • Fred
    • 2 yrs ago
    • Reported - view

    What you are doing is fine, since each purchase record will record the same type of data there is no need for a purchase table for each Rx.

     

    I'm guessing you already have a relationship field to Rx in Purchases. This would be a 1:N relationship (1 record in Rx can have many records in Purchases). So if you look at a record in Rx it will already have created a view that will show all records in Purchases that are linked.

Content aside

  • 2 yrs agoLast active
  • 1Replies
  • 198Views