
224 PUZZLE 56 HOTEL ROOM NUMBERS
PUZZLE
56 HOTEL ROOM NUMBERS
Ron Hiner put this question on CompuServe. He had a data conversion
project where he needed to automatically assign some values to use as
part of the
PRIMARY KEY to a table of hotel rooms.
The floor number is part of the
PRIMARY KEY is the FOREIGN KEY to
another table of floors within the building. The part of the hotel key we
need to create is the room number, which has to be a sequential
number starting at x01 for each floor number x. The hotel is small
enough that we know we will only have three-digit numbers. The table
is defined as follows:
CREATE TABLE Hotel
(floor_nbr INTEGER NOT ...