Bonjour
CREATE TABLE Employé (
Matricule VARCHAR ( 20 ) NOT NULL AUTO_INCREMENT ,
Nom VARCHAR ( 20 ) NOT NULL ,
Prénom VARCHAR ( 20 ) NULL ,
Poste_employé VARCHAR ( 20 ) NULL ,
N°tel INTEGER UNSIGNED NULL ,
PRIMARY KEY ( Matricule, Nom)
);
CREATE TABLE Fournisseur (
Matricule VARCHAR ( 20 ) BINARY NOT NULL AUTO_INCREMENT ,
Nom TEXT NULL ,
Prénom TEXT NULL ,
N°tel INTEGER UNSIGNED NULL ,
Résidence TEXT NULL ,
Ets_Fournisseur TEXT NULL ,
PRIMARY KEY ( Matricule)
);
CREATE TABLE Service (
Code_service VARCHAR ( 20 ) NOT NULL AUTO_INCREMENT ,
Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
Matricule_responsable VARCHAR ( 20 ) NULL ,
Responsable_service TEXT NULL ,
N°tel INTEGER UNSIGNED NULL ,
PRIMARY KEY ( Code service, Employé_Nom, Employé_Matricule),
INDEX Service_FKIndex2( Employé_Matricule, Employé_Nom),
FOREIGN KEY ( Employé_Matricule, Employé_Nom)
REFERENCES Employé( Matricule, Nom)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Agence (
Matricule VARCHAR ( 20 ) NOT NULL AUTO_INCREMENT ,
Nom_Agence TEXT NOT NULL ,
Service_Code_service VARCHAR ( 20 ) NOT NULL ,
Service_Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
Service_Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Ville TEXT NOT NULL ,
Chef_agence TEXT NULL ,
PRIMARY KEY ( Matricule, Nom_Agence, Service_Code_service, Service_Employé_Matricule, Service_Employé_Nom),
INDEX Agence_FKIndex2( Service_Code service, Service_Employé_Nom, Service_Employé_Matricule),
FOREIGN KEY ( Service_Code_service, Service_Employé_Nom, Service_Employé_Matricule)
REFERENCES Service( Code_service, Employé_Nom, Employé_Matricule)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Commander (
Quantité INTEGER UNSIGNED NOT NULL AUTO_INCREMENT ,
Fournisseur_Matricule VARCHAR ( 20 ) BINARY NOT NULL ,
Prix INTEGER UNSIGNED NULL ,
N°commande INTEGER UNSIGNED NULL ,
Date_heure DATETIME NULL ,
PRIMARY KEY ( Quantité, Fournisseur_Matricule),
INDEX Commander_FKIndex1( Fournisseur_Matricule),
FOREIGN KEY ( Fournisseur_Matricule)
REFERENCES Fournisseur( Matricule)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Service_Immobilisation (
Matricule VARCHAR ( 20 ) NOT NULL AUTO_INCREMENT ,
Commander_Fournisseur_Matricule VARCHAR ( 20 ) BINARY NOT NULL ,
Commander_Quantité INTEGER UNSIGNED NOT NULL ,
Responsable TEXT NULL ,
N°tel INTEGER UNSIGNED NULL ,
PRIMARY KEY ( Matricule, Commander_Fournisseur_Matricule, Commander_Quantité),
INDEX Service_Immobilisation_FKIndex1( Commander_Quantité, Commander_Fournisseur_Matricule),
FOREIGN KEY ( Commander_Quantité, Commander_Fournisseur_Matricule)
REFERENCES Commander( Quantité, Fournisseur_Matricule)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Livrer (
Quantité INTEGER UNSIGNED NOT NULL AUTO_INCREMENT ,
Fournisseur_Matricule VARCHAR ( 20 ) BINARY NOT NULL ,
Agence_Nom_Agence TEXT NOT NULL ,
Agence_Matricule VARCHAR ( 20 ) NOT NULL ,
Agence_Service_Code service VARCHAR ( 20 ) NOT NULL ,
Agence_Service_Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Agence_Service_Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
Nom_livreur TEXT NULL ,
N°tel NUMERIC NULL ,
Date_heure DATETIME NULL ,
PRIMARY KEY ( Quantité, Fournisseur_Matricule, Agence_Nom_Agence, Agence_Matricule, Agence_Service_Code_service, Agence_Service_Employé_Nom, Agence_Service_Employé_Matricule),
INDEX Livrer_FKIndex1( Fournisseur_Matricule),
INDEX Livrer_FKIndex2( Agence_Matricule, Agence_Nom_Agence, Agence_Service_Code service, Agence_Service_Employé_Matricule, Agence_Service_Employé_Nom),
FOREIGN KEY ( Fournisseur_Matricule)
REFERENCES Fournisseur( Matricule)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY ( Agence_Matricule, Agence_Nom_Agence, Agence_Service_Code_service, Agence_Service_Employé_Matricule, Agence_Service_Employé_Nom)
REFERENCES Agence( Matricule, Nom_Agence, Service_Code_service, Service_Employé_Matricule, Service_Employé_Nom)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Transmettre (
date_heure DATETIME NOT NULL AUTO_INCREMENT ,
Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
Service_Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
Service_Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Service_Code_service VARCHAR ( 20 ) NOT NULL ,
Agence_Service_Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Agence_Service_Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
Agence_Service_Code_service VARCHAR ( 20 ) NOT NULL ,
Agence_Nom_Agence TEXT NOT NULL ,
Agence_Matricule VARCHAR ( 20 ) NOT NULL ,
Agence_emettteur TEXT NULL ,
Service_emettteur TEXT NULL ,
Employé_émetteur TEXT NULL ,
PRIMARY KEY ( date_heure, Employé_Nom, Employé_Matricule, Service_Employé_Matricule, Service_Employé_Nom, Service_Code service, Agence_Service_Employé_Nom, Agence_Service_Employé_Matricule, Agence_Service_Code_service, Agence_Nom_Agence, Agence_Matricule),
INDEX Transmettre_FKIndex1( Employé_Matricule, Employé_Nom),
INDEX Transmettre_FKIndex2( Service_Code_service, Service_Employé_Nom, Service_Employé_Matricule),
INDEX Transmettre_FKIndex3( Agence_Matricule, Agence_Nom Agence, Agence_Service_Code service, Agence_Service_Employé_Matricule, Agence_Service_Employé_Nom),
FOREIGN KEY ( Employé_Matricule, Employé_Nom)
REFERENCES Employé( Matricule, Nom)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY ( Service_Code_service, Service_Employé_Nom, Service_Employé_Matricule)
REFERENCES Service( Code_service, Employé_Nom, Employé_Matricule)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY ( Agence_Matricule, Agence_Nom_Agence, Agence_Service_Code_service, Agence_Service_Employé_Matricule, Agence_Service_Employé_Nom)
REFERENCES Agence( Matricule, Nom_Agence, Service_Code_service, Service_Employé_Matricule, Service_Employé_Nom)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Renvoyer (
Motif VARCHAR ( 255 ) NOT NULL AUTO_INCREMENT ,
Service_Immobilisation_Matricule VARCHAR ( 20 ) NOT NULL ,
Service _mmobilisation_Commander_Quantité INTEGER UNSIGNED NOT NULL ,
Service_Immobilisation_Commander_Fournisseur_Matricule VARCHAR ( 20 ) BINARY NOT NULL ,
Date_heure DATETIME NULL ,
PRIMARY KEY ( Motif, Service_Immobilisation_Matricule, Service_Immobilisation_Commander_Quantité, Service_Immobilisation_Commander_Fournisseur_Matricule),
INDEX Renvoyer_FKIndex1( Service_Immobilisation_Matricule, Service_Immobilisation_Commander_Fournisseur_Matricule, Service_Immobilisation_Commander_Quantité),
FOREIGN KEY ( Service_Immobilisation_Matricule, Service_Immobilisation_Commander_Fournisseur_Matricule, Service_Immobilisation_Commander_Quantité)
REFERENCES Service_Immobilisation( Matricule, Commander_Fournisseur_Matricule, Commander_Quantité)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Diagnostiquer (
Date_heure DATETIME NOT NULL AUTO_INCREMENT ,
Service_Immobilisation_Matricule VARCHAR ( 20 ) NOT NULL ,
Service_Immobilisation_Commander_Quantité INTEGER UNSIGNED NOT NULL ,
Service_Immobilisation_Commander_Fournisseur_Matricule VARCHAR ( 20 ) BINARY NOT NULL ,
PRIMARY KEY ( Date_heure, Service_Immobilisation_Matricule, Service_Immobilisation_Commander_Quantité, Service_Immobilisation_Commander_Fournisseur_Matricule),
INDEX Diagnostiquer_FKIndex1( Service_Immobilisation_Matricule, Service_Immobilisation_Commander_Fournisseur_Matricule, Service_Immobilisation_Commander_Quantité),
FOREIGN KEY ( Service_Immobilisation_Matricule, Service_Immobilisation_Commander_Fournisseur_Matricule, Service_Immobilisation_Commander_Quantité)
REFERENCES Service_Immobilisation( Matricule, Commander_Fournisseur_Matricule, Commander_Quantité)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Matériel (
N°serie INTEGER UNSIGNED NOT NULL AUTO_INCREMENT ,
Diagnostiquer_Date_heure DATETIME NOT NULL ,
Diagnostiquer_Service_Immobilisation_Matricule VARCHAR ( 20 ) NOT NULL ,
Diagnostiquer_Service_Immobilisation_Commander_Fournisseur_Matricule VARCHAR ( 20 ) BINARY NOT NULL ,
Diagnostiquer_Service_Immobilisation_Commander_Quantité INTEGER UNSIGNED NOT NULL ,
Nom_matériel TEXT NULL ,
Type_matériel TEXT NULL ,
Guarantie YEAR NULL ,
Marque TEXT NULL ,
Fournisseur TEXT NULL ,
PRIMARY KEY ( N°serie, Diagnostiquer_Date_heure, Diagnostiquer_Service_Immobilisation_Matricule, Diagnostiquer_Servic_ Immobilisation_Commander_Fournisseur_Matricule, Diagnostiquer_Service_Immobilisation_Commander_Quantité),
INDEX Matériel_FKIndex1( Diagnostiquer_Date_heure, Diagnostiquer_Service_Immobilisation_Matricule, Diagnostiquer_Service_Immobilisation_Commander_Quantité, Diagnostiquer_Service_Immobilisation_Commander_Fournisseur_Matricule),
FOREIGN KEY ( Diagnostiquer_Date_heure, Diagnostiquer_Service_Immobilisation_Matricule, Diagnostiquer_Service_Immobilisation_Commander_Quantité, Diagnostiquer_Service Immobilisation_Commander_Fournisseur_Matricule)
REFERENCES Diagnostiquer( Date_heure, Service_Immobilisation_Matricule, Service_Immobilisation_Commander_Quantité, Service_Immobilisation_Commander_Fournisseur_Matricule)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE Appartenir (
Agence_Service_Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Agence_Service_Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
Agence_Service_Code_service VARCHAR ( 20 ) NOT NULL ,
Agence_Nom_Agence TEXT NOT NULL ,
Agence_Matricule VARCHAR ( 20 ) NOT NULL ,
Matériel_Diagnostiquer_Service_Immobilisation_Matricule VARCHAR ( 20 ) NOT NULL ,
Matériel_Diagnostiquer_Date_heure DATETIME NOT NULL ,
Matériel_N°serie INTEGER UNSIGNED NOT NULL ,
Service_Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
Service_Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Service_Code_service VARCHAR ( 20 ) NOT NULL ,
Employé_Nom VARCHAR ( 20 ) NOT NULL ,
Employé_Matricule VARCHAR ( 20 ) NOT NULL ,
PRIMARY KEY ( Agence_Service_Employé_Nom, Agence_Service_Employé_Matricule, Agence_Service_Code_service, Agence_Nom_Agence, Agence_Matricule, Matériel_Diagnostiquer_Service_Immobilisation_Matricule, Matériel_Diagnostiquer_Date_heure, Matériel_N°serie, Service_Employé_Matricule, Service_Employé_Nom, Service_Code service, Employé_Nom, Employé_Matricule),
INDEX Appartenir_FKIndex1( Agence_Matricule, Agence_Nom Agence, Agence_Service_Code_service, Agence_Service_Employé_Matricule, Agence_Service_Employé_Nom),
INDEX Appartenir_FKIndex2( Matériel_N°serie, Matériel_Diagnostiquer_Date_heure, Matériel_Diagnostiquer_Service_Immobilisation_Matricule),
INDEX Appartenir_FKIndex3( Service_Code_service, Service_Employé_Nom, Service_Employé_Matricule),
INDEX Appartenir_FKIndex4( Employé_Matricule, Employé_Nom),
FOREIGN KEY ( Agence_Matricule, Agence_Nom_Agence, Agence_Service_Code_service, Agence_Service_Employé_Matricule, Agence_Service_Employé_Nom)
REFERENCES Agence( Matricule, Nom_Agence, Service_Code_service, Service_Employé_Matricule, Service_Employé_Nom)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY ( Matériel_N°serie, Matériel_Diagnostiquer_Date_heure, Matériel_Diagnostiquer_Service_Immobilisation_Matricule, Matériel_Diagnostiquer_Service Immobilisation_Commander_Fournisseur_Matricule, Matériel_Diagnostiquer_Service_Immobilisation_Commander_Quantité)
REFERENCES Matériel( N°serie, Diagnostiquer_Date_heure, Diagnostiquer_Service_Immobilisation_Matricule, Diagnostiquer_Service_Immobilisation_Commander_Fournisseur_Matricule, Diagnostiquer_Service_Immobilisation_Commander_Quantité)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY ( Service_Code_service, Service_Employé_Nom, Service_Employé_Matricule)
REFERENCES Service( Code_service, Employé_Nom, Employé_Matricule)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY ( Employé_Matricule, Employé_Nom)
REFERENCES Employé( Matricule, Nom)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
voici le message ke sql m'a envoyé
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? (
Matricule VARCHAR(20) NOT NULL AUTO_INCREMENT,
Nom VARCHAR(20) NOT NUL' at line 1 jour,
EDIT : Ajout des balises de code (la coloration syntaxique).
Explications disponibles ICI
Merci d'y penser dans tes prochains messages.
Afficher la suite