J'aurai besoin de votre aide et de vos méninges si possible
En effet, je suis en train de créer une nouvelle base de données dans le cadre d'une gestion de procédure dégradée.
Pour une procédure, j'ai besoin de connaître le nom du poste, la/les UF et le/les Types de procédures dégradées qui la composent (UF = zone).
Mais voilà, actuellement je me heurte à un problème. Comment faire pour enregistrer plusieurs UF et plusieurs types de procédures dégradées rattachés à un poste sans avoir une multitude de lignes dans la BDD ?
Infos supplémentaires :
-Un poste peut être dans plusieurs services ou plusieurs UF mais dans un seul site
- pour l'instant, laissons de coter la table "courriel" et "historiser".
#------------------------------------------------------------
# Table: Site
#------------------------------------------------------------
CREATE TABLE Site(
Site_Code Char (2) NOT NULL ,
Site_Lettre Char (2) NOT NULL ,
Site_Label Varchar (50) NOT NULL ,
Site_Domaine Varchar (100) ,
Site_Tigramme Char (3) NOT NULL
,CONSTRAINT Site_AK UNIQUE (Site_Tigramme)
,CONSTRAINT Site_PK PRIMARY KEY (Site_Code)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Service
#------------------------------------------------------------
CREATE TABLE Service(
Site_Code Char (2) NOT NULL ,
Num_CR Char (5) NOT NULL ,
Service_Label Varchar (125) NOT NULL
,CONSTRAINT Service_PK PRIMARY KEY (Site_Code,Num_CR)
,CONSTRAINT Service_Site_FK FOREIGN KEY (Site_Code) REFERENCES Site(Site_Code)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Poste
#------------------------------------------------------------
CREATE TABLE Poste(
Poste_Label Varchar (20) NOT NULL ,
Site_Code Char (2) NOT NULL
,CONSTRAINT Poste_PK PRIMARY KEY (Poste_Label)
,CONSTRAINT Poste_Site_FK FOREIGN KEY (Site_Code) REFERENCES Site(Site_Code)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: UF
#------------------------------------------------------------
CREATE TABLE UF(
Site_Code Char (2) NOT NULL ,
Num_CR Char (5) NOT NULL ,
UF_Code Char (4) NOT NULL ,
UF_Label Varchar (35) NOT NULL
,CONSTRAINT UF_PK PRIMARY KEY (Site_Code,Num_CR,UF_Code)
,CONSTRAINT UF_Service_FK FOREIGN KEY (Site_Code,Num_CR) REFERENCES Service(Site_Code,Num_CR)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Type_ProcDeg
#------------------------------------------------------------
CREATE TABLE Type_ProcDeg(
ID_ProcDeg Int Auto_increment NOT NULL ,
ProDeg_Label Varchar (35) NOT NULL
,CONSTRAINT Type_ProcDeg_AK UNIQUE (ProDeg_Label)
,CONSTRAINT Type_ProcDeg_PK PRIMARY KEY (ID_ProcDeg)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Courriel
#------------------------------------------------------------
CREATE TABLE Courriel(
Courriel_Label Varchar (254) NOT NULL
,CONSTRAINT Courriel_PK PRIMARY KEY (Courriel_Label)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Procéder
#------------------------------------------------------------
CREATE TABLE Proceder(
ID_ProcDeg Int NOT NULL ,
Poste_Label Varchar (20) NOT NULL ,
Site_Code Char (2) NOT NULL ,
Num_CR Char (5) NOT NULL ,
UF_Code Char (4) NOT NULL ,
Matricule Char (8) NOT NULL ,
Commentaire Varchar (254) ,
Date_Create Datetime NOT NULL ,
Date_Modif Date NOT NULL
,CONSTRAINT Proceder_PK PRIMARY KEY (ID_ProcDeg,Poste_Label,Site_Code,Num_CR,UF_Code)
,CONSTRAINT Proceder_Type_ProcDeg_FK FOREIGN KEY (ID_ProcDeg) REFERENCES Type_ProcDeg(ID_ProcDeg)
,CONSTRAINT Proceder_Poste0_FK FOREIGN KEY (Poste_Label) REFERENCES Poste(Poste_Label)
,CONSTRAINT Proceder_UF1_FK FOREIGN KEY (Site_Code,Num_CR,UF_Code) REFERENCES UF(Site_Code,Num_CR,UF_Code)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Historiser
#------------------------------------------------------------
CREATE TABLE Historiser(
Poste_Label Varchar (20) NOT NULL ,
Courriel_Label Varchar (254) NOT NULL ,
Commentaire Varchar (254) ,
Date Datetime NOT NULL
,CONSTRAINT Historiser_PK PRIMARY KEY (Poste_Label,Courriel_Label)
,CONSTRAINT Historiser_Poste_FK FOREIGN KEY (Poste_Label) REFERENCES Poste(Poste_Label)
,CONSTRAINT Historiser_Courriel0_FK FOREIGN KEY (Courriel_Label) REFERENCES Courriel(Courriel_Label)
)ENGINE=InnoDB;
MCD et MLD procédure dégradée
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.