home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cimshop!davidm
- From: davidm@consilium.com (David S. Masterson)
- Newsgroups: comp.databases.theory
- Subject: Re: ordered collections
- Message-ID: <DAVIDM.92Sep2112813@consilium.com>
- Date: 2 Sep 92 18:28:13 GMT
- References: <cdk.715362552@neptune>
- Sender: root@cimshop.UUCP
- Organization: Consilium Inc., Mountain View, California
- Lines: 25
- In-reply-to: cdk@neptune.dsc.com's message of 1 Sep 92 15:49:12 GMT
- X-Posting-Software: GNUS 3.13 [ NNTP-based News Reader for GNU Emacs ]
-
- >>>>> On 1 Sep 92 15:49:12 GMT, cdk@neptune.dsc.com (Colin Kelley) said:
-
- > Is there a standard way to implement ordered collections in a relational
- > database that would allow for random insertion? You could always have a
- > sequence number field to remember the ordering, but if you want random
- > insertion, you may run out of bits in this sequence number and not be able
- > to insert a new entry between two others.
-
- Well, I don't think there is a standard, but here's one way.
-
- 1. Make the primary key be (sequence_number, current_date).
- 2. Generate a new sequence_number for additions to the end of the collection.
- 3. Insertion anywhere else uses the sequence_number of preceding item.
-
- --
- ====================================================================
- David Masterson Consilium, Inc.
- (415) 691-6311 640 Clyde Ct.
- davidm@consilium.com Mtn. View, CA 94043
- ====================================================================
- Trying to shoot yourself in the foot in:
- CLIPPER: You grab a bullet, get ready to insert it in the gun so that you
- can shoot yourself in the foot, and discover that the gun that the
- bullet fits has not yet been built, but should be arriving in the mail
- _REAL_SOON_NOW_. <rboatright>
-