Created
December 12, 2016 13:32
-
-
Save anonymous/4ca16f42d5ea3cd9d1d002086d125825 to your computer and use it in GitHub Desktop.
Script de création des tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------ | |
# 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