Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------------------------
- -- Script Access
- ------------------------------------------------------------
- ------------------------------------------------------------
- -- Table: Client
- ------------------------------------------------------------
- CREATE TABLE Client(
- Num_client TEXT (25) NOT NULL ,
- Nom_client TEXT (50) ,
- Adresse_client TEXT (300) ,
- Tel_client TEXT (15) ,
- CONSTRAINT prk_constraint_Client PRIMARY KEY (Num_client)
- );
- ------------------------------------------------------------
- -- Table: Produit
- ------------------------------------------------------------
- CREATE TABLE Produit(
- Code_produit TEXT (25) NOT NULL ,
- Nom_produit TEXT (150) ,
- prix_public MONEY ,
- CONSTRAINT prk_constraint_Produit PRIMARY KEY (Code_produit)
- );
- ------------------------------------------------------------
- -- Table: Facture
- ------------------------------------------------------------
- CREATE TABLE Facture(
- ref_facture TEXT (25) NOT NULL ,
- Date_achat DATETIME ,
- Num_client TEXT (25) ,
- CONSTRAINT prk_constraint_Facture PRIMARY KEY (ref_facture)
- );
- ------------------------------------------------------------
- -- Table: relation2
- ------------------------------------------------------------
- CREATE TABLE relation2(
- qte_produit DOUBLE ,
- prix_vente MONEY ,
- Code_produit TEXT (25) NOT NULL ,
- ref_facture TEXT (25) NOT NULL ,
- CONSTRAINT prk_constraint_relation2 PRIMARY KEY (Code_produit,ref_facture)
- );
- ALTER TABLE Facture ADD CONSTRAINT FK_Facture_Num_client FOREIGN KEY (Num_client) REFERENCES Client(Num_client);
- ALTER TABLE relation2 ADD CONSTRAINT FK_relation2_Code_produit FOREIGN KEY (Code_produit) REFERENCES Produit(Code_produit);
- ALTER TABLE relation2 ADD CONSTRAINT FK_relation2_ref_facture FOREIGN KEY (ref_facture) REFERENCES Facture(ref_facture);
Advertisement
Add Comment
Please, Sign In to add comment