oh, i 'm sorry, i've given you a blank mail :P
i begin to say: Sorry for my bad english ^^
My problem is:
i have 2 tables,"editoriale" and "ColaboratoreFisso", in the first i have the foreign key of the second and in this
lasttable i have an attribute named MembroCR that can assume only boolean values...
Now, i have to be sure that every row in "ColaboratoreFisso", that has the key also inside "editoriale", has the
attributeMembroCR=TRUE.
So i thought to resolve this with an Assertion, but postgresql doesn't implement it... in what way i can solve my
matter?
This is my code (my first database, so don't blame me if i have writed too much mistakes :P)
CREATE TABLE editoriale (
CodiceE serial PRIMARY KEY,
Titolo varchar(100) NOT NULL,
Testo text NOT NULL,
MembroComitatoRedazione char(16) NOT NULL,
FOREIGN KEY (MembroComitatoRedazione) REFERENCES collaboratoreFisso (CodiceFiscaleF)
ON DELETE CASCADE ON UPDATE CASCADE);
CREATE ASSERTION CONTROLLO_COMITATO
CHECK (NOT EXISTS
( SELECT MembroComitatoRedazione
FROM editoriale
WHERE MembroComitatoRedazione IN
(SELECT CodiceFiscaleF
FROM collaboratoreFisso
WHERE MembroCR = FALSE)));
if you can write me an alternative soulution^^
ANOTHER QUESTION:
I have some problem with my redundancies:
In what way i can implement them? With triggers? I have tried but my code doesn't work, i don't know how to use them :(
Thanks for your help! ^^