I have a order table and each order in that table belongs to either a device or part (these two have no specific intersection in fields).
So I need to store the did or pid as FK in order table.
"device"
+----+....
| id |<---------+
+----+.... :
: : : : . :
:
:
"part" :
+----+.... :
| id |<-------+ :
+----+.... : :
: : : : . : :
: :
: :
"order" @ @
+-----+-------+....
| id | for |....
+-----+-------+....
: : : : : : : : .
Now How should I do this?
- Add a
typefield toordertable and store bothpidordidon one column(e.g.for) - Create an intermediate view with
type,pid,didcolumns - Create a higher level table (e.g.
goods) and make its PK to be FK onorder,part,device
Which one is the best method? or some other method?