
PUZZLE 33 COMPUTING DEPRECIATION 137
PUZZLE
33
COMPUTING DEPRECIATION
This is based on a problem posted by Gerhard F. Jilovec on
CompuServe. He had a manufacturing company database from which he
wished to compute depreciation on the machinery. To this end, his
database has a table of machines, like this:
CREATE TABLE Machines
(machine_name CHAR(20) NOT NULL PRIMARY KEY,
purchase_date DATE NOT NULL,
initial_cost DECIMAL (10,2) NOT NULL,
lifespan INTEGER NOT NULL);
Where the column purchase_date is just what you think—the
purchase date of that machine. The
initial_cost column is the initial
cost of the machine. The lifespan column is the expected ...