1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| /*==============================================================*/
/* Table : BATEAU */
/*==============================================================*/
create table BATEAU
(
CODE_BATEAU int not null auto_increment,
CODE_CLIENT int not null,
CODE_EMPLACEMENT int not null,
CODE_MOTEUR int not null,
NOM_BATEAU char(35),
TYPE_BATEAU char(35),
primary key (CODE_BATEAU)
);
/*==============================================================*/
/* Table : CLES */
/*==============================================================*/
create table CLES
(
CODE_CLES int not null auto_increment,
LIBELLE_CLES char(25),
primary key (CODE_CLES)
);
/*==============================================================*/
/* Table : CLIENT */
/*==============================================================*/
create table CLIENT
(
CODE_CLIENT int not null auto_increment,
NOM_CLIENT char(25),
PRENOM_CLIENT char(25),
TELEPHONE_CLIENT char(10),
ADRESSE_RUE_CLIENT char(150),
ADRESSE_CP_CLIENT char(5),
ADRESSE_VILLE_CLIENT char(30),
primary key (CODE_CLIENT)
);
/*==============================================================*/
/* Table : EMPLACEMENT */
/*==============================================================*/
create table EMPLACEMENT
(
CODE_EMPLACEMENT int not null auto_increment,
NOM_EMPLACEMENT char(25),
PONTON char(15),
REGULIER char(3),
primary key (CODE_EMPLACEMENT)
);
/*==============================================================*/
/* Table : INTERVENTION */
/*==============================================================*/
create table INTERVENTION
(
NUMERO_INTERVENTION int not null auto_increment,
CODE_MECANICIEN int not null,
CODE_CLES int not null,
CODE_BATEAU smallint not null,
DATE_INTERVENTION date,
HEURE_INTERVENTION time,
TRAVAIL_A_FAIRE text,
TRAVAIL_EFFECTUE text,
DUREE_INTERVENTION int,
primary key (NUMERO_INTERVENTION)
);
/*==============================================================*/
/* Table : MECANICIEN */
/*==============================================================*/
create table MECANICIEN
(
CODE_MECANICIEN int not null auto_increment,
NOM_MECANICIEN char(20),
PRENOM_MECANICIEN char(25),
primary key (CODE_MECANICIEN)
);
/*==============================================================*/
/* Table : MOTEUR */
/*==============================================================*/
create table MOTEUR
(
CODE_MOTEUR int not null auto_increment,
MARQUE_MOTEUR char(20),
TYPE_MOTEUR char(20),
TRANSMISSION varchar(20),
primary key (CODE_MOTEUR)
);
alter table BATEAU add constraint FK_APPARTENIR foreign key (CODE_CLIENT)
references CLIENT (CODE_CLIENT) on delete restrict on update restrict;
alter table BATEAU add constraint FK_CORRESPONDRE foreign key (CODE_MOTEUR)
references MOTEUR (CODE_MOTEUR) on delete restrict on update restrict;
alter table BATEAU add constraint FK_MOUILLER foreign key (CODE_EMPLACEMENT)
references EMPLACEMENT (CODE_EMPLACEMENT) on delete restrict on update restrict;
alter table INTERVENTION add constraint FK_CORRESPONDRE_2 foreign key (CODE_CLES)
references CLES (CODE_CLES) on delete restrict on update restrict;
alter table INTERVENTION add constraint FK_INTERVENIR foreign key (CODE_MECANICIEN)
references MECANICIEN (CODE_MECANICIEN) on delete restrict on update restrict;
alter table INTERVENTION add constraint FK_SUBIR foreign key (CODE_BATEAU)
references BATEAU (CODE_BATEAU) on delete restrict on update restrict; |
Partager