Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcsun!hp4nl!eurtrx!euraiv1!reino From: reino@cs.eur.nl (Reino de Boer) Newsgroups: comp.databases Subject: Unique code numbers Message-ID: <1990Jan16.081519.279@cs.eur.nl> Date: 16 Jan 90 08:15:19 GMT Organization: Erasmus Universiteit Rotterdam, dept. CS (Informatica) Lines: 38 For the first time in my life I am planning a reasonably large database, and I have run across a (solvable) problem. A lot of examples in literature about relational databases involve the following kind of relationships: Supplier = (Name, Address, etc., Parts supplied) Part = (Name, Description, etc., Suppliers) which is then normalized to 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 ) but I would like a more general mechanism. Perhaps a special field data type `unique id', that generates a new value when needed. Awaiting your replies, thanks already -- Reino -- Reino R. A. de Boer Erasmus University Rotterdam ( Informatica ) e-mail: reino@cs.eur.nl