-- ---------------- Création des tables -----------------------------------------
--
-- ---------------- 1- table Client ---------------------------------------------
--
create table Client
(
cli_num NUMBER not null constraint pk_Client primary key,
cli_nom VARCHAR (15),
cli_adresse VARCHAR (30),
cli_datederniereconsultation DATE,
cli_secteur NUMBER
-- constraint pk Client primary key (cli_num)
);
-- ---------------- 2- table Type_Compte -------------------------------------- --
create table Type_Compte
(
tcpt_type VARCHAR (3) not null constraint pk_Type_Compte primary key,
tcpt_intitule VARCHAR (20)
--constraint pk_Type_Compte primary key (tcpt_tуре)
);
-- ---------------- 3- table Compte ------------------------------------------- --
create table Compte
(
cpt_num NUMBER not null constraint pk_Compte primary key,
cpt_libelle VARCHAR (20),
cpt_datedemandechequier DATE,
cpt_solde NUMBER (10,21),
cpt_decouvertautorise NUMBER (3,23),
cpt_numcli NUMBER, constraint fk_cpt_numcli
foreign key (cpt_numcli) references Client (cli_num),
cpt_typecompte VARCHAR (3), constraint fk_cpt_typecompte
foreign key (cpt_typecompte) references Type_Compte
(tcpt_type)
/*
constraint pk_Compte primary key,
constraint fk_cpt_numcli foreign key (cpt_numcli) references Client (cli_num),
constraint fk_cpt_typecompte foreign key (cpt_typecompte) references
Type_Compte (tcpt_type)
*/
);
-- ---------------- 4- table Type_Operation ----------------------------------- --
create table Type_Operation
(
topr_type VARCHAR(10) not null constraint pk_Type_Operation primary key
--constraint pk Type Operation primary key (topr_type)
);
-- ---------------- 5- table Operations -------------------------------------- --
create table Operations
(
opr_num NUMBER not null constraint pk_Operations primary key,
opr_libelle VARCHAR(20),
opr_montant NUMBER(8,2),
opr_dateoperation DATE,
opr_nuncompte NUMBER, constraint fk_opr_numcompte foreign key (opr_nuncompte)
references Compte(cpt_num),
opr_typeoperation VARCHAR(10), constraint fk_opr_typeoperation foreign key
(opr_typeoperation)
references Type_Operation (topr_type)
/*
constraint pk_Operations primary key,
constraint fk_opr_numcompte foreign key (opr_nuncompte) references
Compte(cpt_num),
constraint fk_opr_typeoperation foreign key (opr_typeoperation) references
Type_Operation (topr_type)
*/
);