Clinique_RO.sql 1.22 KB
Newer Older
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CREATE OR REPLACE TYPE traitement AS OBJECT (
    id_traitement NUMBER NOT NULL,
    debut DATE NOT NULL,
    duree NUMBER NOT NULL,
    quantite NUMBER NOT NULL,
    veterinaire VARCHAR(30) NOT NULL,
    medicament VARCHAR(30) NOT NULL
);
/


CREATE OR REPLACE TYPE listTraitements AS TABLE OF traitement;
/

CREATE OR REPLACE TYPE animal AS OBJECT (
    id_animal NUMBER NOT NULL,
    nom VARCHAR(20),
    poid FLOAT,
    TAILLE FLOAT,
    dn DATE,
    traitements listTraitements NOT NULL,
    PRIMARY KEY (id_animal)
23
) NESTED TABLE traitements STORED AS l_traitements;
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
24
25
26
27
28
29
30
31
32
33
/
CREATE OR REPLACE TYPE listeAnimals AS TABLE OF animal;
/
CREATE OR REPLACE TABLE clients (
    id_client NUMBER NOT NULL,
    nom VARCHAR(20) NOT NULL,
    prenom VARCHAR(20) NOT NULL,
    dn DATE NOT NULL,
    adresse VARCHAR(50) NOT NULL,
    n_tel NUMBER NOT NULL,
34
    animals listeAnimals NOT NULL,
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
35
    PRIMARY KEY(id_client)
36
)NESTED TABLE animals STORED AS l_animals;
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/

CREATE OR REPLACE TABLE classeEspece(
    classeEscpece VARCHAR(30) NOT NULL PRIMARY KEY
);
/

CREATE OR REPLACE TABLE espece(
    classeEspece VARCHAR(30) NOT NULL,
    espece VARCHAR(20) NOT NULL,
    PRIMARY KEY(espece),
    FOREIGN KEY (classeEspece) REFERENCES classeEspece(classeEspece)
);
/