Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2016 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4ca16f42d5ea3cd9d1d002086d125825 to your computer and use it in GitHub Desktop.
Save anonymous/4ca16f42d5ea3cd9d1d002086d125825 to your computer and use it in GitHub Desktop.
Script de création des tables
#------------------------------------------------------------
# Script MySQL.
#------------------------------------------------------------
#------------------------------------------------------------
# Table: Champs
#------------------------------------------------------------
CREATE TABLE Champs(
champ_id int (11) Auto_increment NOT NULL ,
champ_lib Varchar (25) NOT NULL ,
PRIMARY KEY (champ_id )
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Users
#------------------------------------------------------------
CREATE TABLE Users(
user_id int (11) Auto_increment NOT NULL ,
user_name Varchar (25) NOT NULL ,
PRIMARY KEY (user_id )
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Champs_verifie
#------------------------------------------------------------
CREATE TABLE Champs_verifie(
date_verification Date NOT NULL,
champ_id Int NOT NULL ,
user_id Int NOT NULL ,
PRIMARY KEY (champ_id ,user_id )
)ENGINE=InnoDB;
ALTER TABLE Champs_verifie ADD CONSTRAINT FK_Champs_verifie_champ_id FOREIGN KEY (champ_id) REFERENCES Champs(champ_id);
ALTER TABLE Champs_verifie ADD CONSTRAINT FK_Champs_verifie_user_id FOREIGN KEY (user_id) REFERENCES Users(user_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment