You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.5 KiB
105 lines
2.5 KiB
2 years ago
|
DROP TABLE if exists Planification;
|
||
|
DROP TABLE if exists Operation;
|
||
|
DROP TABLE if exists Echeancier;
|
||
|
DROP TABLE if exists Compte;
|
||
|
DROP TABLE if exists InscrBanque;
|
||
|
DROP TABLE if exists Banque;
|
||
|
DROP TABLE if exists DeviseInscrit;
|
||
|
DROP TABLE if exists Inscrit;
|
||
|
DROP TABLE if exists Devise;
|
||
2 years ago
|
|
||
|
|
||
|
CREATE TABLE Devise
|
||
|
(
|
||
|
id char(3) PRIMARY KEY,
|
||
|
nom varchar(20)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE Inscrit
|
||
|
(
|
||
2 years ago
|
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
|
||
2 years ago
|
nom varchar(40),
|
||
|
prenom varchar(40),
|
||
|
mail varchar(40) UNIQUE,
|
||
|
mdp varchar(40)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE DeviseInscrit
|
||
|
(
|
||
|
devise char(3),
|
||
2 years ago
|
idInscrit MEDIUMINT UNIQUE,
|
||
2 years ago
|
PRIMARY KEY(devise,idInscrit),
|
||
|
FOREIGN KEY (devise) REFERENCES Devise(id),
|
||
|
FOREIGN KEY (idInscrit) REFERENCES Inscrit(id)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE Banque
|
||
|
(
|
||
|
nom varchar(40) PRIMARY KEY,
|
||
|
urlsite varchar(60),
|
||
2 years ago
|
urllogo longblob
|
||
2 years ago
|
);
|
||
|
|
||
|
CREATE TABLE InscrBanque
|
||
|
(
|
||
2 years ago
|
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
|
||
2 years ago
|
nomBanque varchar(40),
|
||
2 years ago
|
idInscrit MEDIUMINT,
|
||
2 years ago
|
UNIQUE(nomBanque,idInscrit),
|
||
|
FOREIGN KEY (nomBanque) REFERENCES Banque(nom),
|
||
|
FOREIGN KEY (idInscrit) REFERENCES Inscrit(id)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE Compte
|
||
|
(
|
||
2 years ago
|
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
|
||
2 years ago
|
nom varchar(40),
|
||
2 years ago
|
idInscritBanque MEDIUMINT,
|
||
2 years ago
|
FOREIGN KEY (idInscritBanque) REFERENCES InscrBanque(id),
|
||
|
UNIQUE(idInscritBanque,nom)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE Echeancier
|
||
|
(
|
||
2 years ago
|
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
|
||
2 years ago
|
nom varchar(40),
|
||
|
credit numeric,
|
||
2 years ago
|
compte MEDIUMINT,
|
||
2 years ago
|
debit numeric,
|
||
|
dateE date,
|
||
|
datecrea date,
|
||
|
methodePayement varchar(20),
|
||
2 years ago
|
CONSTRAINT ck_echan CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')),
|
||
2 years ago
|
FOREIGN KEY(compte) REFERENCES Compte(id),
|
||
|
UNIQUE (datecrea,compte)
|
||
|
);
|
||
|
|
||
2 years ago
|
CREATE TABLE Operation
|
||
2 years ago
|
(
|
||
2 years ago
|
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
|
||
2 years ago
|
nom varchar(40),
|
||
|
credit numeric,
|
||
2 years ago
|
compte MEDIUMINT,
|
||
2 years ago
|
debit numeric,
|
||
|
dateO date,
|
||
|
datecrea date,
|
||
|
methodePayement varchar(20),
|
||
|
CONSTRAINT ck_methPaye CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')),
|
||
|
FOREIGN KEY(compte) REFERENCES Compte(id),
|
||
|
UNIQUE (datecrea,compte)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE Planification
|
||
|
(
|
||
2 years ago
|
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
|
||
2 years ago
|
nom varchar(40),
|
||
|
credit numeric,
|
||
2 years ago
|
compte MEDIUMINT,
|
||
2 years ago
|
debit numeric,
|
||
|
dateP date,
|
||
|
datecrea date,
|
||
|
methodePayement varchar(20),
|
||
2 years ago
|
CONSTRAINT ck_planif CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')),
|
||
2 years ago
|
FOREIGN KEY(compte) REFERENCES Compte(id),
|
||
|
UNIQUE (datecrea,compte)
|
||
2 years ago
|
);
|