
200 PUZZLE 49 WIDGET COUNT
PUZZLE
49 WIDGET COUNT
You get a production report from production centers that have a date, a
production center code, and how many widgets were produced from
each batch of raw materials sent to the center that day. It looks like this:
CREATE TABLE Production
(production_center INTEGER NOT NULL,
wk_date DATE NOT NULL,
batch_nbr INTEGER NOT NULL,
widget_cnt INTEGER NOT NULL,
PRIMARY KEY (production_center, wk_date, batch_nbr));
The boss comes in and wants to know the average number of widgets
produced in all batches by date and production center. You say “No
problem” and do it. The next day your boss comes back and ...