Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Primary Key Theory Question

Re: Primary Key Theory Question

From: Leandro Guimar„es Faria Corsetti Dutra <leandro_at_dutra.fastmail.fm>
Date: Tue, 30 Mar 2004 17:47:15 -0300
Message-ID: <pan.2004.03.30.20.47.13.381490@dutra.fastmail.fm>


Em Sun, 28 Mar 2004 21:53:07 +0000, Ben escreveu:

> _how_ does one
> generate a surrogate key that is a) unique and b) usable from an
> application programmer's point of view.

        For the programmers, SEQUENCEs are about as good as it gets. PostgreSQL's serial is also good. I am not familiar with SQL Servers' identity...

        Now obviously any surrogate key alone *is* a recipe for disaster. That's why one needs still to implement uniqueness constraints for the natural candidate keys. Surrogates are only to keep programmers and users from whining about composite keys.

> sequences and Identity columns are great from an application developers
> point of view because you have easy access to the key of a newly created
> record.

        Sequences are nice too, SELECT sequence.nextval FROM dual;

-- 
Leandro Guimar„es Faria Corsetti Dutra <leandro_at_dutra.fastmail.fm>
MaringŠ, PR, BRASIL
http://br.geocities.com./lgcdutra/
Soli Deo Gloria!
Received on Tue Mar 30 2004 - 14:47:15 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US