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

Home -> Community -> Usenet -> comp.databases.theory -> Identity key?

Identity key?

From: DODO <dodo_at_Ihatespam.com>
Date: Fri, 5 Jan 2001 16:55:24 -0500
Message-ID: <hpr56.114963$Z2.1336437@nnrp1.uunet.ca>

Hello,

I have a question regarding an observation made by Joe Celko in an article. Quoting the article:



For example, this was posted on a newsgroup:

CREATE TABLE US_States
(state_id IDENTITY NOT NULL,

 state_abbreviation CHAR(2) NOT NULL,
 state_name VARCHAR(15) NOT NULL);

The idiot who did this assumed that the IDENTITY column was a key. Those other two columns better be unique or this thing is not going to work. The correct declaration should have been something like this:

CREATE TABLE US_States
(state_code CHAR(2) NOT NULL PRIMARY KEY,
 state_name VARCHAR(15) NOT NULL UNIQUE);


Woulldn't be better to have the table like this?

CREATE TABLE US_States
(state_id IDENTITY,

state_code CHAR(2) NOT NULL PRIMARY KEY,  state_name VARCHAR(15) NOT NULL UNIQUE);

TIA, DODO Received on Fri Jan 05 2001 - 15:55:24 CST

Original text of this message

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