Hi, can you please help me with tha databaze ? I don´t know what the problem could be.
Thanks.
CREATE
TABLE Cviceni
(
id_cviceni INTEGER NOT NULL ,
nazev_cviceni VARCHAR (50) NOT NULL ,
typ_cviceni VARCHAR (15) ,
Sportovec_id_sportovce INTEGER NOT NULL ,
CONSTRAINT Cviceni_PK PRIMARY KEY CLUSTERED (id_cviceni)
WITH
(
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON
)
ON "default"
)
ON "default"
GO
CREATE
TABLE Cvici
(
id_cviceni INTEGER NOT NULL ,
id_sportovce INTEGER NOT NULL ,
pocet_cviceni INTEGER NOT NULL ,
Cviceni_id_cviceni INTEGER NOT NULL ,
Sportovec_id_sportovce INTEGER NOT NULL
CONSTRAINT Cvici__IDX PRIMARY KEY CLUSTERED (id_cviceni,
id_sportovce)
)
ON "default"
GO
CREATE
TABLE Dieta
(
id_diety INTEGER NOT NULL ,
nazev_diety VARCHAR (50) NOT NULL ,
typ_diety VARCHAR (20) ,
id_sportovce INTEGER ,
Sportovec_id_sportovce INTEGER NOT NULL ,
CONSTRAINT Dieta_PK PRIMARY KEY CLUSTERED (id_diety)
WITH
(
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON
)
ON "default"
)
ON "default"
GO
CREATE UNIQUE NONCLUSTERED INDEX
Dieta__IDX ON Dieta
(
Sportovec_id_sportovce
)
ON "default"
GO
CREATE
TABLE Fitness
(
nazev_fitness VARCHAR (40) NOT NULL ,
rok_zalozeni INTEGER ,
mesto VARCHAR (30) ,
CONSTRAINT Fitness_PK PRIMARY KEY CLUSTERED (nazev_fitness)
WITH
(
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON
)
ON "default"
)
ON "default"
GO
CREATE
TABLE Sportovec
(
id_sportovce INTEGER NOT NULL ,
jmeno VARCHAR (30) NOT NULL ,
rok_narozeni INTEGER ,
pohlavi VARCHAR (4) NOT NULL ,
nazev_fitness VARCHAR (40) NOT NULL ,
Fitness_nazev_fitness VARCHAR (40) NOT NULL ,
CONSTRAINT Sportovec_PK PRIMARY KEY CLUSTERED (id_sportovce)
WITH
(
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON
)
ON "default"
)
ON "default"
GO
ALTER TABLE Cviceni
ADD CONSTRAINT Cviceni_Sportovec_FK FOREIGN KEY
(
Sportovec_id_sportovce
)
REFERENCES Sportovec
(
id_sportovce
)
ON
DELETE
NO ACTION ON
UPDATE NO ACTION
GO
ALTER TABLE Cvici
ADD CONSTRAINT Cvici_Cviceni_FK FOREIGN KEY
(
Cviceni_id_cviceni
)
REFERENCES Cviceni
(
id_cviceni
)
ON
DELETE
NO ACTION ON
UPDATE NO ACTION
GO
ALTER TABLE Cvici
ADD CONSTRAINT Cvici_Sportovec_FK FOREIGN KEY
(
Sportovec_id_sportovce
)
REFERENCES Sportovec
(
id_sportovce
)
ON
DELETE
NO ACTION ON
UPDATE NO ACTION
GO
ALTER TABLE Dieta
ADD CONSTRAINT Dieta_Sportovec_FK FOREIGN KEY
(
Sportovec_id_sportovce
)
REFERENCES Sportovec
(
id_sportovce
)
ON
DELETE
NO ACTION ON
UPDATE NO ACTION
GO
ALTER TABLE Sportovec
ADD CONSTRAINT Sportovec_Fitness_FK FOREIGN KEY
(
Fitness_nazev_fitness
)
REFERENCES Fitness
(
nazev_fitness
)
ON
DELETE
NO ACTION ON
UPDATE NO ACTION
GO
-- Oracle SQL Developer Data Modeler Summary Report:
--
-- CREATE TABLE 5
-- CREATE INDEX 1
-- ALTER TABLE 5
-- CREATE VIEW 0
-- CREATE PACKAGE 0
-- CREATE PACKAGE BODY 0
-- CREATE PROCEDURE 0
-- CREATE FUNCTION 0
-- CREATE TRIGGER 0
-- ALTER TRIGGER 0
-- CREATE DATABASE 0
-- CREATE DEFAULT 0
-- CREATE INDEX ON VIEW 0
-- CREATE ROLLBACK SEGMENT 0
-- CREATE ROLE 0
-- CREATE RULE 0
-- CREATE PARTITION FUNCTION 0
-- CREATE PARTITION SCHEME 0
--
-- DROP DATABASE 0
--
-- ERRORS 0
-- WARNINGS 0
insert into Fitness values ('Contours', 2002, 'Ostrava');
insert into Fitness values ('Fit_Balance', 2008, 'Opava');
insert into Fitness values ('Budu_fit_club', 2011, 'Hrabůvka');
insert into Fitness values ('FitClub', 2010, 'Havířov');
insert into Sportovec values (1, 'Novotný', 1980, 'muž', 'Fit_Balance');
insert into Sportovec values (2, 'Heider', 1991, 'muž', 'FitClub');
insert into Sportovec values (3, 'Novák', 1986, 'muž', 'Budu_fit_club');
insert into Sportovec values (4, 'Poštulková', 1990, 'žena', 'Contours');
insert into Sportovec values (5, 'Berdych', 1983, 'muž', 'Contours');
insert into Sportovec values (6, 'Dvořák', 1974, 'muž', 'Fit_Balance');
insert into Sportovec values (7, 'Hamilton', 1972, 'muž', 'FitClub');
insert into Sportovec values (8, 'Nováková', 1982, 'žena', 'Budu_fit_club');
insert into Sportovec values (9, 'Bolt', 1986, 'muž', 'Contours');
insert into Sportovec values (10,'Suchý', 1988, 'muž', 'FitClub');
insert into Sportovec values (11, 'Blažková', 1991, 'žena', 'Fit_Balance');
insert into Sportovec values (12, 'Majer', 1983, 'muž', 'Budu_fit_club');
insert into Sportovec values (13, 'Poláková', 1990, 'žena', 'FitClub');
insert into Cviceni values (1, 'Kruhový trénink', 'posilování');
insert into Cviceni values (2, 'Spinning', 'cardio');
insert into Cviceni values (3, 'Trampolínky', 'jumping');
insert into Cviceni values (4, 'Fit box', 'cardio');
insert into Cviceni values (5, 'Osobní trénink', 'posilování');
insert into Cviceni values (6, 'Bodystyling', 'posilování');
insert into Cviceni values (7, 'Vibrogym', 'posilování');
insert into Cviceni values (8, 'Zumba', 'cardio');
insert into Cvici values (1, 2, 6);
insert into Cvici values (1, 3, 3);
insert into Cvici values (1, 7, 7);
insert into Cvici values (1, 6, 9);
insert into Cvici values (2, 11, 11);
insert into Cvici values (2, 9, 2);
insert into Cvici values (2, 8, 1);
insert into Cvici values (3, 5, 6);
insert into Cvici values (3, 1, 14);
insert into Cvici values (3, 6, 7);
insert into Cvici values (4, 9, 9);
insert into Cvici values (4, 13, 6);
insert into Cvici values (4, 12, 2);
insert into Cvici values (5, 3, 3);
insert into Cvici values (6, 6, 9);
insert into Cvici values (6, 7, 3);
insert into Cvici values (6, 4, 12);
insert into Cvici values (6, 8, 10);
insert into Cvici values (6, 11, 9);
insert into Cvici values (6, 13, 8);
insert into Cvici values (7, 1, 3);
insert into Cvici values (7, 5, 7);
insert into Cvici values (7, 4, 9);
insert into Cvici values (8, 3, 11);
insert into Cvici values (8, 9, 12);
insert into Cvici values (8, 6, 16);
insert into Cvici values (8, 10, 9);
insert into Cvici values (8, 12, 10);
insert into Dieta values (1, 'Krabičková', 'měsíční', 2);
insert into Dieta values (2, 'Racionální', 'půlroční', 8);
insert into Dieta values (3, 'Uhlohydrátová', 'měsíční', 12);
insert into Dieta values (4, 'Diabetická', 'roční', 11);
insert into Dieta values (5, 'Vegetariánská', 'měsíční', 10);
insert into Dieta values (6, 'Bílkovinná', 'dvoutýdenní', 6);
insert into Dieta values (7, 'Atkinsonova', 'měsíční', 13);