Gossamer Forum
Home : General : Databases and SQL :

Use of UNIQUE - Question

Quote Reply
Use of UNIQUE - Question
I am designing a table which is part of a vehicle registry.

The table has an ID column as an its primary and autoincrementing key:

$c1->pk('ID');
$c1->ai('ID');

Another field in this table is the vehicles identification number (VIN) which needs to be unique. How do I force a unique set upon this column?

VIN => { pos => 2, type => 'INT', not_null => 1, regex => '^\d+$' },

I have read http://www.mysql.com/...A/L/ALTER_TABLE.html and the LSQL docs and I am still confused on the use of the UNIQUE syntax.

Thanks


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] Use of UNIQUE - Question In reply to
GT module documentation.

GT/SQL/Creator -> unique/index.

Example. $c1->unique( { u_vin => ['VIN'] } );

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Use of UNIQUE - Question In reply to
The example was what I was after... thanks Ivan!


EDIT: its confusing seeing both our posts having the same avtar!


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jul 6, 2002, 10:03 AM