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 109 110 111 112 113 114 115 116 117
| /*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 31/03/2012 09:26:13 */
/*==============================================================*/
drop table if exists Agence;
drop table if exists Arret;
drop table if exists Banque;
drop table if exists Dab;
drop table if exists Typepanne;
drop table if exists Utilisateur;
/*==============================================================*/
/* Table: Agence */
/*==============================================================*/
create table Agence
(
CodeAgence varchar(20) not null UNIQUE,
Adresse varchar(40) NOT NULL,
ChefAgence varchar(20) NOT NULL UNIQUE,
nombq varchar(19) DEFAULT 'Banque de l"Habitat' not null,
primary key (CodeAgence)
)
ENGINE = InnoDB;
/*==============================================================*/
/* Table: Arret */
/*==============================================================*/
create table Arret
(
Num int(11) NOT NULL AUTO_INCREMENT,
NumDab int(11) NOT NULL,
DateD_arret date NOT NULL,
heureD_arret time DEFAULT NULL,
Codepannes int(11) NOT NULL,
Datereprise date DEFAULT NULL,
Heurereprise time DEFAULT NULL,
Duree time DEFAULT NULL,
Ordre int(11) DEFAULT NULL,
EtatD_arret varchar(10) NOT NULL,
primary key (Num)
)
ENGINE = InnoDB;
/*==============================================================*/
/* Table: Banque */
/*==============================================================*/
create table Banque
(
Nom varchar(19) DEFAULT 'Banque de l"Habitat' not null,
Adresse varchar(35) DEFAULT '18 avenue Mohamed V 1080 Tunis',
primary key (Nom)
)
ENGINE = InnoDB;
/*==============================================================*/
/* Table: Dab */
/*==============================================================*/
create table Dab
(
numdab int(11) NOT NULL AUTO_INCREMENT,
Fournisseur varchar(20) NOT NULL,
DateD_installaion date NOT NULL,
codeAG varchar(20) NOT NULL,
localite varchar(20) DEFAULT NULL,
primary key (numdab)
)
ENGINE = InnoDB;
/*==============================================================*/
/* Table: Panne */
/*==============================================================*/
create table Typepanne
(
Codepanne int(11) NOT NULL AUTO_INCREMENT,
libele VARCHAR(255) NOT NULL UNIQUE,
description VARCHAR(255),
PRIMARY KEY (Codepanne)
)
ENGINE = InnoDB;
/*==============================================================*/
/* Table: Utilisateur */
/*==============================================================*/
create table Utilisateur
(
NomU varchar(25) NOT NULL UNIQUE,
Login varchar(12) NOT NULL UNIQUE,
Code varchar(10) NOT NULL UNIQUE,
Pwds varbinary(16) NOT NULL,
nombq char(19) DEFAULT 'Banque de l"Habitat',
primary key (NomU)
)
ENGINE = InnoDB;
alter table Agence add constraint BANQUE foreign key (nombq)
references Banque (Nom) ON DELETE CASCADE ON UPDATE CASCADE;
alter table Arret add constraint PANNE foreign key (Codepannes)
references Typepanne (Codepanne) ON DELETE CASCADE ON UPDATE CASCADE;
alter table Arret add constraint DAB foreign key (NumDab)
references Dab (numdab) ON DELETE CASCADE ON UPDATE CASCADE;
alter table Dab add constraint BANQUE foreign key (codeAG)
references Agence (CodeAgence) ON DELETE CASCADE on UPDATE CASCADE;
alter table Utilisateur add constraint UTILISATEUR foreign key (nombq)
references Banque (Nom) ON DELETE CASCADE ON UPDATE CASCADE; |
Partager