| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Identity key?
Hello,
I have a question regarding an observation made by Joe Celko in an article. Quoting the article:
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
![]() |
![]() |