
PUZZLE 11 WORK ORDERS 45
PUZZLE
11 WORK ORDERS
Cenk Ersoy asked this question on the Gupta Forum on CompuServe. In
a factory, a project is described in a work order, which has a series of
steps that it must go through. A
step_nbr on the work order is either
completed or awaiting the completion of one or more of the steps that
come before it. His table looks like this:
CREATE TABLE Projects
(workorder_id CHAR(5) NOT NULL,
step_nbr INTEGER NOT NULL CHECK (step_nbr BETWEEN 0 AND
1000),
step_status CHAR(1) NOT NULL
CHECK (step_status IN ('C', 'W')), -- complete, waiting
PRIMARY KEY (workorder_id, step_nbr));
With some sample data like this:
Projects ...