Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Unique constraint or index as in Oracle and "alter table alter column"



For example, in a police database, column VEHICLE.VIN could be NULL 
(which makes sence, let's consider a situation when witnesses describe
a hit-and-run accident, then
number plate and/or VIN may be not known). How to implement a
requirement that if VIN is known, it has to be unique?

I've created a separate entity for VIN and removed VIN column from
VEHICLE table
CREATE TABLE VEHICLE(VEHICLE_ID INT NOT NULL PRIMARY KEY, ... );
CREATE TABLE VIN(VEHICLE_ID INT NOT NULL PRIMARY KEY, VIN VARCHAR(30)
UNIQUE);

The technique is called inheritance of primary key



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.