Drop table Obchod_obj cascade constraints

Drop table Obchod_obj succeeded.
Drop table Nakup_obj cascade constraints

Drop table Nakup_obj succeeded.
Drop table Komponent_obj cascade constraints

Drop table Komponent_obj succeeded.
Drop table Vidlice_obj cascade constraints

Drop table Vidlice_obj succeeded.
Drop table Ram_obj cascade constraints

Drop table Ram_obj succeeded.
Drop table Plast_obj cascade constraints

Drop table Plast_obj succeeded.
Drop table Zkusenost_obj cascade constraints

Drop table Zkusenost_obj succeeded.
Drop table Zavod_obj cascade constraints

Drop table Zavod_obj succeeded.
Drop table Lokace_obj cascade constraints

Drop table Lokace_obj succeeded.
Drop table Jezdec_obj cascade constraints

Drop table Jezdec_obj succeeded.
Drop table Hodnoceni_obj cascade constraints

Drop table Hodnoceni_obj succeeded.
Drop table Disciplina_obj cascade constraints

Drop table Disciplina_obj succeeded.
Drop table pouziva_obj cascade constraints

Drop table pouziva_obj succeeded.
Drop table se_ucastnil_obj cascade constraints

Drop table se_ucastnil_obj succeeded.
Drop table ma_rad_obj cascade constraints

Drop table ma_rad_obj succeeded.
Drop type Obchod_t FORCE

Drop type Obchod_t succeeded.
Drop type Nakup_t FORCE

Drop type Nakup_t succeeded.
Drop type Komponent_t FORCE

Drop type Komponent_t succeeded.
Drop type Vidlice_t FORCE

Drop type Vidlice_t succeeded.
Drop type Ram_t FORCE

Drop type Ram_t succeeded.
Drop type Plast_t FORCE

Drop type Plast_t succeeded.
Drop type Zkusenost_t FORCE

Drop type Zkusenost_t succeeded.
Drop type Zavod_t FORCE

Drop type Zavod_t succeeded.
Drop type Lokace_t FORCE

Drop type Lokace_t succeeded.
Drop type Jezdec_t FORCE

Drop type Jezdec_t succeeded.
Drop type Hodnoceni_t FORCE

Drop type Hodnoceni_t succeeded.
Drop type Disciplina_t FORCE

Drop type Disciplina_t succeeded.
Drop type pouziva_t FORCE

Drop type pouziva_t succeeded.
Drop type se_ucastnil_t FORCE

Drop type se_ucastnil_t succeeded.
Drop type ma_rad_t FORCE

Drop type ma_rad_t succeeded.
CREATE OR REPLACE TYPE Obchod_t AS OBJECT (
      Nazev VarChar2(50),
      Adresa VarChar2(255),
      WWW VarChar2(100)
);

TYPE Obchod_t Compiled.
CREATE OR REPLACE TYPE Nakup_t AS OBJECT (
      Cena Float,
      Datum Date
);

TYPE Nakup_t Compiled.
CREATE OR REPLACE TYPE Komponent_t AS OBJECT (
      Model VarChar2(50),
      Vyrobce VarChar2(50),
      Rok_vyroby Char(4)
);

TYPE Komponent_t Compiled.
CREATE OR REPLACE TYPE Vidlice_t AS OBJECT (
      Zdvih Float,
      Polomer_kola Integer
);

TYPE Vidlice_t Compiled.
CREATE OR REPLACE TYPE Ram_t AS OBJECT (
      Polomer_kola Integer,
      Velikost Float
);

TYPE Ram_t Compiled.
CREATE OR REPLACE TYPE Plast_t AS OBJECT (
      Polomer Integer,
      Sirka Float
);

TYPE Plast_t Compiled.
CREATE OR REPLACE TYPE Zkusenost_t AS OBJECT (
      Slovni_hodnoceni VarChar2(255),
      Hodnoceni Integer,
      Cena_vykon Integer
);

TYPE Zkusenost_t Compiled.
CREATE OR REPLACE TYPE Zavod_t AS OBJECT (
      Nazev VarChar2(100),
      Startovne Float,
      Datum Date
);

TYPE Zavod_t Compiled.
CREATE OR REPLACE TYPE Lokace_t AS OBJECT (
      Nazev VarChar2(50),
      Umisteni VarChar2(255),
      Popis VarChar2(255)
);

TYPE Lokace_t Compiled.
CREATE OR REPLACE TYPE Jezdec_t AS OBJECT (
      Jmeno VarChar2(30),
      Prijmeni VarChar2(30),
      ID_jezdce Integer,
      Prezdivka VarChar2(50),
      E_mail VarChar2(50)
);

TYPE Jezdec_t Compiled.
CREATE OR REPLACE TYPE Hodnoceni_t AS OBJECT (
      Sortiment Integer,
      Ceny Integer,
      Privetivost Integer,
      Slovni_hodnoceni VarChar2(255)
);

TYPE Hodnoceni_t Compiled.
CREATE OR REPLACE TYPE Disciplina_t AS OBJECT (
      Popis VarChar2(255),
      Nazev VarChar2(30)
);

TYPE Disciplina_t Compiled.
CREATE OR REPLACE TYPE pouziva_t AS OBJECT (
      -- pri pouziti referenci je potreba jen jeden odkaz na komponent
      Role23_Komponent REF Komponent_t
      /*Role23_Model REF Komponent_t,
      Role23_Vyrobce REF Komponent_t,
      Role23_Rok_vyroby REF Komponent_t*/,
      Role11_ID_jezdce REF Jezdec_t
);

TYPE pouziva_t Compiled.
CREATE OR REPLACE TYPE se_ucastnil_t AS OBJECT (
      -- pri pouziti referenci je potreba jen jeden odkaz na zavod
      Role9_Zavod REF Zavod_t
      /*Role9_Datum REF Zavod_t,
      Role9_Di_Nazev REF Disciplina_t,
      Role9_Lo_Nazev REF Lokace_t*/,
      Role10_ID_jezdce REF Jezdec_t
);

TYPE se_ucastnil_t Compiled.
CREATE OR REPLACE TYPE ma_rad_t AS OBJECT (
      Role3_ID_jezdce REF Jezdec_t,
      Role6_Nazev REF Disciplina_t
);

TYPE ma_rad_t Compiled.
ALTER TYPE Nakup_t ADD attribute Ob_Nazev REF Obchod_t CASCADE

ALTER TYPE Nakup_t succeeded.
ALTER TYPE Nakup_t ADD attribute Je_ID_jezdce REF Jezdec_t CASCADE

ALTER TYPE Nakup_t succeeded.
-- pri pouziti referenci je potreba jen jeden odkaz na komponent

ALTER TYPE Nakup_t ADD attribute Ko_Komponent REF Komponent_t CASCADE

ALTER TYPE Nakup_t succeeded.
/*ALTER TYPE Nakup_t ADD attribute Ko_Model REF Komponent_t CASCADE;
ALTER TYPE Nakup_t ADD attribute Ko_Vyrobce REF Komponent_t CASCADE;
ALTER TYPE Nakup_t ADD attribute Ko_Rok_vyroby REF Komponent_t CASCADE;*/

ALTER TYPE Vidlice_t ADD attribute Ko_Komponent REF Komponent_t CASCADE

ALTER TYPE Vidlice_t succeeded.
/*ALTER TYPE Vidlice_t ADD attribute Ko_Model REF Komponent_t CASCADE;
ALTER TYPE Vidlice_t ADD attribute Ko_Vyrobce REF Komponent_t CASCADE;
ALTER TYPE Vidlice_t ADD attribute Ko_Rok_vyroby REF Komponent_t CASCADE;*/

ALTER TYPE Ram_t ADD attribute Ko_Komponent REF Komponent_t CASCADE

ALTER TYPE Ram_t succeeded.
/*ALTER TYPE Ram_t ADD attribute Ko_Model REF Komponent_t CASCADE;
ALTER TYPE Ram_t ADD attribute Ko_Vyrobce REF Komponent_t CASCADE;
ALTER TYPE Ram_t ADD attribute Ko_Rok_vyroby REF Komponent_t CASCADE;*/

ALTER TYPE Plast_t ADD attribute Ko_Komponent REF Komponent_t CASCADE

ALTER TYPE Plast_t succeeded.
/*ALTER TYPE Plast_t ADD attribute Ko_Model REF Komponent_t CASCADE;
ALTER TYPE Plast_t ADD attribute Ko_Vyrobce REF Komponent_t CASCADE;
ALTER TYPE Plast_t ADD attribute Ko_Rok_vyroby REF Komponent_t CASCADE;*/

ALTER TYPE Zkusenost_t ADD attribute Ko_Komponent REF Komponent_t CASCADE

ALTER TYPE Zkusenost_t succeeded.
/*ALTER TYPE Zkusenost_t ADD attribute Ko_Model REF Komponent_t CASCADE;
ALTER TYPE Zkusenost_t ADD attribute Ko_Vyrobce REF Komponent_t CASCADE;
ALTER TYPE Zkusenost_t ADD attribute Ko_Rok_vyroby REF Komponent_t CASCADE;*/

ALTER TYPE Zkusenost_t ADD attribute Je_ID_jezdce REF Jezdec_t CASCADE

ALTER TYPE Zkusenost_t succeeded.
ALTER TYPE Zavod_t ADD attribute Di_Nazev REF Disciplina_t CASCADE

ALTER TYPE Zavod_t succeeded.
ALTER TYPE Zavod_t ADD attribute Lo_Nazev REF Lokace_t CASCADE

ALTER TYPE Zavod_t succeeded.
ALTER TYPE Hodnoceni_t ADD attribute Ob_Nazev REF Obchod_t CASCADE

ALTER TYPE Hodnoceni_t succeeded.
ALTER TYPE Hodnoceni_t ADD attribute Je_ID_jezdce REF Jezdec_t CASCADE

ALTER TYPE Hodnoceni_t succeeded.
CREATE TABLE Obchod_obj OF Obchod_t (
      Nazev NOT NULL UNIQUE,
      Adresa NOT NULL
)

CREATE TABLE succeeded.
CREATE TABLE Nakup_obj OF Nakup_t (
      Cena NOT NULL,
      Datum NOT NULL,
      Ob_Nazev NOT NULL,
      Je_ID_jezdce NOT NULL,
      -- pri pouziti referenci je potreba jen jeden odkaz na komponent
      Ko_Komponent NOT NULL
      /*Ko_Model NOT NULL,
      Ko_Vyrobce NOT NULL,
      Ko_Rok_vyroby NOT NULL*/
)

CREATE TABLE succeeded.
CREATE TABLE Komponent_obj OF Komponent_t (
      Model NOT NULL,
      Vyrobce NOT NULL,
      Rok_vyroby NOT NULL,
      Unique(Model, Vyrobce, Rok_vyroby)
)

CREATE TABLE succeeded.
CREATE TABLE Vidlice_obj OF Vidlice_t (
      Zdvih NOT NULL,
      Polomer_kola NOT NULL,
      -- pri pouziti referenci je potreba jen jeden odkaz na komponent
      Ko_Komponent NOT NULL
      /*Ko_Model NOT NULL,
      Ko_Vyrobce NOT NULL,
      Ko_Rok_vyroby NOT NULL*/
)

CREATE TABLE succeeded.
CREATE TABLE Ram_obj OF Ram_t (
      Polomer_kola NOT NULL,
      Velikost NOT NULL,
      -- pri pouziti referenci je potreba jen jeden odkaz na komponent
      Ko_Komponent NOT NULL
      /*Ko_Model NOT NULL,
      Ko_Vyrobce NOT NULL,
      Ko_Rok_vyroby NOT NULL*/
)

CREATE TABLE succeeded.
CREATE TABLE Plast_obj OF Plast_t (
      Polomer NOT NULL,
      Sirka NOT NULL,
      -- pri pouziti referenci je potreba jen jeden odkaz na komponent
      Ko_Komponent NOT NULL
      /*Ko_Model NOT NULL,
      Ko_Vyrobce NOT NULL,
      Ko_Rok_vyroby NOT NULL*/
)

CREATE TABLE succeeded.
CREATE TABLE Zkusenost_obj OF Zkusenost_t (
      Hodnoceni NOT NULL,
      Cena_vykon NOT NULL,
      -- pri pouziti referenci je potreba jen jeden odkaz na komponent
      Ko_Komponent NOT NULL
      /*Ko_Model NOT NULL,
      Ko_Vyrobce NOT NULL,
      Ko_Rok_vyroby NOT NULL*/,
      Je_ID_jezdce NOT NULL
)

CREATE TABLE succeeded.
CREATE TABLE Zavod_obj OF Zavod_t (
      Nazev NOT NULL,
      Datum NOT NULL UNIQUE,
      Di_Nazev NOT NULL,
      Lo_Nazev NOT NULL
)

CREATE TABLE succeeded.
CREATE TABLE Lokace_obj OF Lokace_t (
      Nazev NOT NULL UNIQUE
)

CREATE TABLE succeeded.
CREATE TABLE Jezdec_obj OF Jezdec_t (
      Jmeno NOT NULL,
      Prijmeni NOT NULL,
      ID_jezdce NOT NULL UNIQUE,
      Prezdivka NOT NULL,
      E_mail NOT NULL
)

CREATE TABLE succeeded.
CREATE TABLE Hodnoceni_obj OF Hodnoceni_t (
      Sortiment NOT NULL,
      Ceny NOT NULL,
      Privetivost NOT NULL,
      Ob_Nazev NOT NULL,
      Je_ID_jezdce NOT NULL
)

CREATE TABLE succeeded.
CREATE TABLE Disciplina_obj OF Disciplina_t (
      Nazev NOT NULL UNIQUE
)

CREATE TABLE succeeded.
CREATE TABLE pouziva_obj OF pouziva_t (
      -- pri pouziti referenci je potreba jen jeden odkaz na komponent
      Role23_Komponent NOT NULL
      /*Role23_Model NOT NULL,
      Role23_Vyrobce NOT NULL,
      Role23_Rok_vyroby NOT NULL*/,
      Role11_ID_jezdce NOT NULL
)

CREATE TABLE succeeded.
CREATE TABLE se_ucastnil_obj OF se_ucastnil_t (
      -- pri pouziti referenci je potreba jen jeden odkaz na zavod
      Role9_Zavod NOT NULL
      /*Role9_Datum NOT NULL,
      Role9_Di_Nazev NOT NULL,
      Role9_Lo_Nazev NOT NULL*/,
      Role10_ID_jezdce NOT NULL
)

CREATE TABLE succeeded.
CREATE TABLE ma_rad_obj OF ma_rad_t (
      Role3_ID_jezdce NOT NULL,
      Role6_Nazev NOT NULL
)

CREATE TABLE succeeded.
ALTER TABLE Nakup_obj ADD FOREIGN KEY (Ob_Nazev) REFERENCES Obchod_obj

ALTER TABLE Nakup_obj succeeded.
ALTER TABLE Nakup_obj ADD FOREIGN KEY (Je_ID_jezdce) REFERENCES Jezdec_obj

ALTER TABLE Nakup_obj succeeded.
-- pri pouziti referenci je potreba jen jeden odkaz na komponent

ALTER TABLE Nakup_obj ADD FOREIGN KEY (Ko_Komponent) REFERENCES Komponent_obj

ALTER TABLE Nakup_obj succeeded.
/*ALTER TABLE Nakup_obj ADD FOREIGN KEY (Ko_Model) REFERENCES Komponent_obj;
ALTER TABLE Nakup_obj ADD FOREIGN KEY (Ko_Vyrobce) REFERENCES Komponent_obj;
ALTER TABLE Nakup_obj ADD FOREIGN KEY (Ko_Rok_vyroby) REFERENCES Komponent_obj;*/

ALTER TABLE Vidlice_obj ADD FOREIGN KEY (Ko_Komponent) REFERENCES Komponent_obj

ALTER TABLE Vidlice_obj succeeded.
/*ALTER TABLE Vidlice_obj ADD FOREIGN KEY (Ko_Model) REFERENCES Komponent_obj;
ALTER TABLE Vidlice_obj ADD FOREIGN KEY (Ko_Vyrobce) REFERENCES Komponent_obj;
ALTER TABLE Vidlice_obj ADD FOREIGN KEY (Ko_Rok_vyroby) REFERENCES Komponent_obj;*/

ALTER TABLE Ram_obj ADD FOREIGN KEY (Ko_Komponent) REFERENCES Komponent_obj

ALTER TABLE Ram_obj succeeded.
/*ALTER TABLE Ram_obj ADD FOREIGN KEY (Ko_Model) REFERENCES Komponent_obj;
ALTER TABLE Ram_obj ADD FOREIGN KEY (Ko_Vyrobce) REFERENCES Komponent_obj;
ALTER TABLE Ram_obj ADD FOREIGN KEY (Ko_Rok_vyroby) REFERENCES Komponent_obj;*/

ALTER TABLE Plast_obj ADD FOREIGN KEY (Ko_Komponent) REFERENCES Komponent_obj

ALTER TABLE Plast_obj succeeded.
/*ALTER TABLE Plast_obj ADD FOREIGN KEY (Ko_Model) REFERENCES Komponent_obj;
ALTER TABLE Plast_obj ADD FOREIGN KEY (Ko_Vyrobce) REFERENCES Komponent_obj;
ALTER TABLE Plast_obj ADD FOREIGN KEY (Ko_Rok_vyroby) REFERENCES Komponent_obj;*/

ALTER TABLE Zkusenost_obj ADD FOREIGN KEY (Ko_Komponent) REFERENCES Komponent_obj

ALTER TABLE Zkusenost_obj succeeded.
/*ALTER TABLE Zkusenost_obj ADD FOREIGN KEY (Ko_Model) REFERENCES Komponent_obj;
ALTER TABLE Zkusenost_obj ADD FOREIGN KEY (Ko_Vyrobce) REFERENCES Komponent_obj;
ALTER TABLE Zkusenost_obj ADD FOREIGN KEY (Ko_Rok_vyroby) REFERENCES Komponent_obj;*/

ALTER TABLE Zkusenost_obj ADD FOREIGN KEY (Je_ID_jezdce) REFERENCES Jezdec_obj

ALTER TABLE Zkusenost_obj succeeded.
ALTER TABLE Zavod_obj ADD FOREIGN KEY (Di_Nazev) REFERENCES Disciplina_obj

ALTER TABLE Zavod_obj succeeded.
ALTER TABLE Zavod_obj ADD FOREIGN KEY (Lo_Nazev) REFERENCES Lokace_obj

ALTER TABLE Zavod_obj succeeded.
ALTER TABLE Hodnoceni_obj ADD FOREIGN KEY (Ob_Nazev) REFERENCES Obchod_obj

ALTER TABLE Hodnoceni_obj succeeded.
ALTER TABLE Hodnoceni_obj ADD FOREIGN KEY (Je_ID_jezdce) REFERENCES Jezdec_obj

ALTER TABLE Hodnoceni_obj succeeded.
ALTER TABLE pouziva_obj ADD FOREIGN KEY (Role23_Komponent) REFERENCES Komponent_obj

ALTER TABLE pouziva_obj succeeded.
/*ALTER TABLE pouziva_obj ADD FOREIGN KEY (Role23_Model) REFERENCES Komponent_obj;
ALTER TABLE pouziva_obj ADD FOREIGN KEY (Role23_Vyrobce) REFERENCES Komponent_obj;
ALTER TABLE pouziva_obj ADD FOREIGN KEY (Role23_Rok_vyroby) REFERENCES Komponent_obj;*/

ALTER TABLE pouziva_obj ADD FOREIGN KEY (Role11_ID_jezdce) REFERENCES Jezdec_obj

ALTER TABLE pouziva_obj succeeded.
ALTER TABLE se_ucastnil_obj ADD FOREIGN KEY (Role9_Zavod) REFERENCES Zavod_obj

ALTER TABLE se_ucastnil_obj succeeded.
/*ALTER TABLE se_ucastnil_obj ADD FOREIGN KEY (Role9_Datum) REFERENCES Zavod_obj;
ALTER TABLE se_ucastnil_obj ADD FOREIGN KEY (Role9_Di_Nazev) REFERENCES Disciplina_obj;
ALTER TABLE se_ucastnil_obj ADD FOREIGN KEY (Role9_Lo_Nazev) REFERENCES Lokace_obj;*/

ALTER TABLE se_ucastnil_obj ADD FOREIGN KEY (Role10_ID_jezdce) REFERENCES Jezdec_obj

ALTER TABLE se_ucastnil_obj succeeded.
ALTER TABLE ma_rad_obj ADD FOREIGN KEY (Role3_ID_jezdce) REFERENCES Jezdec_obj

ALTER TABLE ma_rad_obj succeeded.
ALTER TABLE ma_rad_obj ADD FOREIGN KEY (Role6_Nazev) REFERENCES Disciplina_obj

ALTER TABLE ma_rad_obj succeeded.
