Posted by Bruce on October 24, 2005 at 12:11:16:
In Reply to: Sub Keys are NOT unique posted by Jim Guerber on October 23, 2005 at 09:36:54:
Jim,
I also agree that all sub-keys should be ordered by sub-key + primary key.
Usually,the primary key is the first field in the record.
If so, then since sub-keys must be in consecutive positions in a record, we cannot set-up a sub-key that would include the primary key.....
Ex 1: order detail file - primary key would be order # plus line #
If I wanted all orders for a specific item.
I would want my sub-key to be item #, but I would expect any display for a specific item to be in sequential order #.
If not, program would need to read all orders for this item & sort by order #.
Currently, we would create a keyed file by: item/order/line #
Ex 2: Open orders by shipment date
If sub key is shipment date, you can't have invoices displayed by when they were entered, you would want them by order #.
If sub-keys are not ordered, then in many/most cases they would be incomplete and they would always a sort before displaying results