1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| CREATE TABLE Agence( num_agence NUMBER (10) NOT NULL,
nom_agence VARCHAR (20) DEFAULT NULL,
adr_agence VARCHAR (20) DEFAULT NULL,
CONSTRAINTS pk_Agence PRIMARY KEY (num_agence)
);
CREATE TABLE Client(
num_client NUMBER (6) NOT NULL,
nom_client VARCHAR (20) NOT NULL,
adr_client VARCHAR (20) DEFAULT NULL,
CONSTRAINTS pk_Client PRIMARY KEY (num_client,nom_client)
);
CREATE TABLE Compte(
num_compte NUMBER (10) NOT NULL,
num_agence NUMBER (10) NOT NULL,
num_client NUMBER (6) NOT NULL,
solde NUMBER (10,3) DEFAULT NULL,
CONSTRAINT pk_Compte PRIMARY KEY (num_compte,num_agence,num_client),
CONSTRAINT fk_Compte_Agence FOREIGN KEY (num_agence) REFERENCES Agence (num_agence),
CONSTRAINT fk_Compte_num_client FOREIGN KEY (num_client) REFERENCES Client(num_client) #à ce niveau
); |
Partager