
82 PUZZLE 19 TOP SALESPEOPLE
PUZZLE
19 TOP SALESPEOPLE
This problem came up in March 1995 at Database World, when someone
came back from the IBM pavilion to talk to me. IBM had a DB2 expert
with a whiteboard set up to answer questions, and this one had stumped
her. The problem starts with a table of salespeople and the amount of
their sales, which looks like this:
CREATE TABLE SalesData
(district_nbr INTEGER NOT NULL,
sales_person CHAR(10) NOT NULL,
sales_id INTEGER NOT NULL,
sales_amt DECIMAL(5,2) NOT NULL);
The boss just came in and asked for a report that will tell him about
the three biggest sales and salespeople in each district. Let’s use this ...