Skip navigation links

MySQL Forums :: Serbian/Croatian/Bosnian :: Imam problem sa umetanjem podataka u bazu - baza mi nije u redu


Advanced Search

Imam problem sa umetanjem podataka u bazu - baza mi nije u redu
Posted by: milos petrovic ()
Date: January 24, 2009 03:09PM

Pozdrav



Pozdrav, moze li mi iko da mi PREPRAVI OVAJ CODEE...

Sql code:

CREATE TABLE film (
naziv CHAR(50) NOT NULL,
godina INTEGER NOT NULL,
trajanje DATETIME,
ime_studia VARCHAR(50) NOT NULL
);


ALTER TABLE film
ADD PRIMARY KEY (naziv, godina);


CREATE TABLE filmski_ljudi (
ime_ljudi VARCHAR(50) NOT NULL,
adresa_ljudi VARCHAR(50)
);


ALTER TABLE filmski_ljudi
ADD PRIMARY KEY (ime_ljudi);


CREATE TABLE president_studia (
ime_ljudi VARCHAR(50) NOT NULL,
ime_presidenta VARCHAR(50),
adresa VARCHAR(50),
god_prihod INTEGER
);


ALTER TABLE president_studia
ADD PRIMARY KEY (ime_ljudi);


CREATE TABLE studio (
ime_studia VARCHAR(50) NOT NULL,
adresa_studia VARCHAR(50),
god_osnivanja CHAR(18)
);


ALTER TABLE studio
ADD PRIMARY KEY (ime_studia);


CREATE TABLE ugovor (
zarada VARCHAR(50),
ime_studia VARCHAR(50) NOT NULL,
naziv CHAR(50) NOT NULL,
godina INTEGER NOT NULL,
datum_potp DATETIME
);



ALTER TABLE ugovor
ADD PRIMARY KEY (ime_studia, naziv, godina);


CREATE TABLE zvezde (
ime_studia VARCHAR(50) NOT NULL,
ime_zvezde VARCHAR(50),
datum_rodjenja_zve DATETIME
);


ALTER TABLE zvezde
ADD PRIMARY KEY (ime_studia);


ALTER TABLE film
ADD FOREIGN KEY (ime_studia)
REFERENCES studio(ime_studia);


ALTER TABLE president_studia
ADD FOREIGN KEY (ime_ljudi)
REFERENCES filmski_ljudi(ime_ljudi);


ALTER TABLE studio
ADD FOREIGN KEY (ime_studia)
REFERENCES president_studia(ime_ljudi);


ALTER TABLE ugovor
ADD FOREIGN KEY (ime_studia)
REFERENCES studio(ime_studia);


ALTER TABLE ugovor
ADD FOREIGN KEY (ime_studia)
REFERENCES zvezde(ime_studia);


ALTER TABLE ugovor
ADD FOREIGN KEY (naziv, godina)
REFERENCES film(naziv, godina);


ALTER TABLE ugovor
ADD FOREIGN KEY (ime_studia)
REFERENCES studio(ime_studia);


ALTER TABLE zvezde
ADD FOREIGN KEY (ime_studia)
REFERENCES filmski_ljudi(ime_ljudi);


ALTER TABLE zvezde
ADD FOREIGN KEY (ime_studia)
REFERENCES studio(ime_studia);




Ne mogu da umetnem podatke u bazu, npr.
INSERT INTO FILM VALUES('FDSFDS',1999,'12:12','FDSFDSF')
JAVLJA MI GRESKU TIPA

*********'''CANNOT ADD OR UPDATE CHILD .... A FOREYGN KEY CONTSTAINT FAIL...********


UNAPRIJED HVALA

Options: ReplyQuote


Subject Views Written By Posted
Imam problem sa umetanjem podataka u bazu - baza mi nije u redu 5835 milos petrovic 01/24/2009 03:09PM
Re: Imam problem sa umetanjem podataka u bazu - baza mi nije u redu 4361 Josip Cagalj 03/04/2009 03:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.