Hello friends,
Sorry for posting the question in this section as I couldn't figure out an appropriate section.
I am trying to design a table which is intended to hold data related to vendors.
Every vendor can receive one or more orders. The table should hold vendors along with orders received
For example:
Vendor A received 1 order, vendor B received 2 orders and vendor C received 5 orders
A-->ord1
B-->ord1, ord2
C-->ord1, ord2, ord3, ord4, ord5
What is the best way to design such a table?
Thanks a bunch in advance
Yamini
Help with a new table design
Moderators: chulett, rschirm, roy
Re: Help with a new table design
Hi Yamini,yaminids wrote: A-->ord1
B-->ord1, ord2
C-->ord1, ord2, ord3, ord4, ord5
Yamini
You can post such Questions in General forum.
Anyways, since the number of orders for each vendor is not 'fixed', you can have a generic table like
VENDOR_NAME | ORDER_NAME | ORDER_DETAIL
A | Ord1 | Order1
B | Ord1 | Order1
B | Ord2 | Order2
and so on..
This is my suggestion. Lets us see others' opinion.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
Re: Help with a new table design
Yamini,yaminids wrote: For example:
Vendor A received 1 order, vendor B received 2 orders and vendor C received 5 orders
A-->ord1
B-->ord1, ord2
C-->ord1, ord2, ord3, ord4, ord5
What is the best way to design such a table?
Yamini
If you are trying to build this table in a non-multi valued database (as Pagadrai was suggesting), then you need to have separate rows for a combination of each Vendor and Order (number or name??). You can have them as Primary keys and the rest of the details, if you have any, as attributes.
Code: Select all
VENDOR(PK) ORDER NUMBER(PK) ORDER NAME ...
A 123 Order1
B 234 Order2
B 345 Order3
C 456 Order4
C 567 Order5
C 678 Order6
Let us know if this is what you were looking for...!
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Depending on your need, and whether there are any columns dependent on just one column of the primary key, you may be able to get away with just the one table, with one row for each order. You can select distinct vendor from this as required.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.