Subject | Re: [ib-support] Is there any UNIQUE limit? |
---|---|
Author | Raul Chirea |
Post date | 2002-07-03T10:41:30Z |
Hi Matteo,
First, I send allready a correction but it apears it didn't got there ! It
was:
========= Correction message =========
Correction !
create table FILES (
id integer not null,
name varchar(200) not null,
constraint FILES_PK primary key (id),
constraint FILES_NAME_UK unique (name)
);
So, for each (unique) id you'll have an unique file name.
========= End correction message =========
Second,
From: "Matteo Giacomazzi" <matteo.giacomazzi@...>
- a UNIQUE KEY is a CONSTRAINT
- a FOREIGN KEY is a CONSTRAINT
- a CHECK is, also, a CONSTRAINT
- a column NOT NULL is a CONSTRAINT
Another thing is that:
- a FOREIGN KEY can reference only a PRIMARY KEY or a UNIQUE KEY.
What Helen wanted to said is that when you make a unique key constraint or a
foreign key constraint IB automatically makes an index on the key fields
(you can see it with an admin tool, it has a system generated name).
That's all.
Regards !
Raul.
-------------------------------------------------------
Xnet scaneaza automat toate mesajele impotriva virusilor folosind RAV AntiVirus.
Xnet automatically scans all messages for viruses using RAV AntiVirus.
Nota: RAV AntiVirus poate sa nu detecteze toti virusii noi sau toate variantele lor. Va rugam sa luati in considerare ca exista un risc de fiecare data cand deschideti fisiere atasate si ca MobiFon nu este responsabila pentru nici un prejudiciu cauzat de virusi.
Disclaimer: RAV AntiVirus may not be able to detect all new viruses and variants. Please be aware that there is a risk involved whenever opening e-mail attachments to your computer and that MobiFon is not responsible for any damages caused by viruses.
First, I send allready a correction but it apears it didn't got there ! It
was:
========= Correction message =========
Correction !
> create table FILES (The above one is wrong ! Replace it with this !
> id integer not null,
> file varchar(200) not null,
> constraint FILES_PK primary key (id, file)
> );
create table FILES (
id integer not null,
name varchar(200) not null,
constraint FILES_PK primary key (id),
constraint FILES_NAME_UK unique (name)
);
So, for each (unique) id you'll have an unique file name.
========= End correction message =========
Second,
From: "Matteo Giacomazzi" <matteo.giacomazzi@...>
> HB> If you want a column or group to be a key, you must apply theNo, It's a matter of classification:
> HB> appropriate constraint. And don't create additional indexes that
> HB> are identical to the constraint indexes!!
>
> Okay: now I'm confused! :)
> What's the difference between an UNIQUE CONSTRAINT and an UNIQUE KEY
> CONSTRAINT?
> Is it only a logical one?
> I mean: a foreign key may references a primary key and an unique key
> but it cannot reference an unique constraint wich is not key?
- a UNIQUE KEY is a CONSTRAINT
- a FOREIGN KEY is a CONSTRAINT
- a CHECK is, also, a CONSTRAINT
- a column NOT NULL is a CONSTRAINT
Another thing is that:
- a FOREIGN KEY can reference only a PRIMARY KEY or a UNIQUE KEY.
What Helen wanted to said is that when you make a unique key constraint or a
foreign key constraint IB automatically makes an index on the key fields
(you can see it with an admin tool, it has a system generated name).
That's all.
Regards !
Raul.
-------------------------------------------------------
Xnet scaneaza automat toate mesajele impotriva virusilor folosind RAV AntiVirus.
Xnet automatically scans all messages for viruses using RAV AntiVirus.
Nota: RAV AntiVirus poate sa nu detecteze toti virusii noi sau toate variantele lor. Va rugam sa luati in considerare ca exista un risc de fiecare data cand deschideti fisiere atasate si ca MobiFon nu este responsabila pentru nici un prejudiciu cauzat de virusi.
Disclaimer: RAV AntiVirus may not be able to detect all new viruses and variants. Please be aware that there is a risk involved whenever opening e-mail attachments to your computer and that MobiFon is not responsible for any damages caused by viruses.