| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Multiple parent tables?
>> I'm building an ordering/workflow system which involves, among
others,
these three entities: Orders, Items, Revisions. <<
Please post DDL instead of narratives. I would design this differently. I cannot understand an order without any items, as pre your specs -- perhaps they are reserved in advance? Next, a revision is not made to an order; it is made to an item.
CREATE TABLE Orders
(order_nbr INTEGER NOT NULL PRIMARY KEY,
...);
CREATE TABLE Order_Items
(order_nbr INTEGER NOT NULL
REFERENCES Orders(order_nbr)
ON UPDATE CASCADE
ON DELETE CASCADE,
When you want to revise an item, put the new version into the table. The current data can be seen in the VIEW
CREATE VIEW Current_Items (order_nbr, item_date, item_nbr, quantity,
...)
SELECT order_nbr, item_date, item_nbr, quantity, ...
FROM Order_Items AS I1
WHERE item_date
This keeps your history in one place and makes the queries a bit easier. Received on Fri Oct 26 2001 - 19:40:49 CDT
![]() |
![]() |