Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!asuvax!mcdphx!mcdchg!ddsw1!michael From: michael@ddsw1.MCS.COM (Michael Duebner) Newsgroups: comp.databases Subject: Re: Unique code numbers Message-ID: <1990Jan17.023805.3105@ddsw1.MCS.COM> Date: 17 Jan 90 02:38:05 GMT References: <1990Jan16.081519.279@cs.eur.nl> Reply-To: michael@mcs.MCS.COM (Michael Duebner) Organization: Macro Computer Solutions, Inc. - Mundelein, IL Lines: 41 In article <1990Jan16.081519.279@cs.eur.nl> reino@cs.eur.nl (Reino de Boer) writes: >For the first time in my life I am planning a reasonably large database, >and I have run across a (solvable) problem. > [...some lines deleted...] >Supplier = (SupplierID, Name, Address, etc.) >Part = (PartID, Name, Description, etc.) >SP = (SupplierID, PartID) > >I was wondering if there is a relational DBMS that gives me the >opportunity to indicate that: >1. SupplierIDs need to be unique >2. PartIDs need to be unique >and, most important of all >3. Frees me from the burden to make up new SupplierIDs and PartIDs. > >The problem is solvable by introducing a new relation for each ID: >IDconfig = (lastID) >and generating the new unique ID by something along >ID <- retrieve( lastID ) >update( lastID ) >store( lastID ) > >Reino R. A. de Boer >Erasmus University Rotterdam ( Informatica ) >e-mail: reino@cs.eur.nl Here is an example in FOCUS, a 4GL that is not quite a relational database, we seem to prefere the parent child, multi segment instances environment. You can assign numbers quite simply by describing the key field so that it is numeric and sorted high to low. This is required since in FOCUS there is no 'go to EOF', read the last and highest key used. However, it is possible to go to the beginning of the file, then take one step forward and read that key value. Add 1 to it and you have a unique keyvalue. Michael Duebner (michael@ddsw1.MCS.COM, !ddsw1!michael) Voice: (708) 566-8910 Macro Computer Solutions, Inc. "Quality Solutions at a Fair Price"