|  | @@ -1,30 +1,35 @@
 | 
	
		
			
			| 1 |  | -DROP TABLE IF EXISTS question;
 | 
	
		
			
			|  | 1 | +DROP TABLE IF EXISTS questions;
 | 
	
		
			
			| 2 | 2 |  DROP TABLE IF EXISTS reponses;
 | 
	
		
			
			| 3 | 3 |  DROP TABLE IF EXISTS categorie;
 | 
	
		
			
			| 4 | 4 |  DROP TABLE IF EXISTS scores;
 | 
	
		
			
			| 5 | 5 |  
 | 
	
		
			
			| 6 |  | -CREATE TABLE categorie (
 | 
	
		
			
			| 7 |  | -	nom_cat		VARCHAR(30) PRIMARY KEY
 | 
	
		
			
			| 8 |  | -) ENGINE=INNODB;
 | 
	
		
			
			|  | 6 | +CREATE TABLE categorie(
 | 
	
		
			
			|  | 7 | +        nom_cat Varchar (30) NOT NULL ,
 | 
	
		
			
			|  | 8 | +        PRIMARY KEY (nom_cat )
 | 
	
		
			
			|  | 9 | +)ENGINE=InnoDB;
 | 
	
		
			
			| 9 | 10 |  
 | 
	
		
			
			| 10 |  | -CREATE TABLE reponses (
 | 
	
		
			
			| 11 |  | -	reponse1	VARCHAR(50),
 | 
	
		
			
			| 12 |  | -	reponse2	VARCHAR(50),
 | 
	
		
			
			| 13 |  | -	nom_cat		VARCHAR(30) NOT NULL,
 | 
	
		
			
			| 14 |  | -	PRIMARY KEY(reponse1, reponse2),
 | 
	
		
			
			| 15 |  | -	FOREIGN KEY(nom_cat) REFERENCES categorie(nom_cat) ON DELETE CASCADE ON UPDATE CASCADE
 | 
	
		
			
			| 16 |  | -) ENGINE=INNODB;
 | 
	
		
			
			|  | 11 | +CREATE TABLE reponses(
 | 
	
		
			
			|  | 12 | +        reponse1 Varchar (50) NOT NULL ,
 | 
	
		
			
			|  | 13 | +        reponse2 Varchar (50) NOT NULL ,
 | 
	
		
			
			|  | 14 | +        nom_cat  Varchar (30) ,
 | 
	
		
			
			|  | 15 | +        INDEX (reponse2),
 | 
	
		
			
			|  | 16 | +        PRIMARY KEY (reponse1 ,reponse2 )
 | 
	
		
			
			|  | 17 | +)ENGINE=InnoDB;
 | 
	
		
			
			| 17 | 18 |  
 | 
	
		
			
			| 18 |  | -CREATE TABLE question (
 | 
	
		
			
			| 19 |  | -	intitule	VARCHAR(120),
 | 
	
		
			
			| 20 |  | -	reponse1	VARCHAR(50),
 | 
	
		
			
			| 21 |  | -	reponse2	VARCHAR(50),
 | 
	
		
			
			| 22 |  | -	reponse		INTEGER NOT NULL,
 | 
	
		
			
			| 23 |  | -	PRIMARY KEY(intitule, reponse1, reponse2),
 | 
	
		
			
			| 24 |  | -	FOREIGN KEY(reponse1, reponse2) REFERENCES reponses(reponse1, reponse2) ON DELETE CASCADE ON UPDATE CASCADE
 | 
	
		
			
			| 25 |  | -) ENGINE=INNODB;
 | 
	
		
			
			|  | 19 | +CREATE TABLE questions(
 | 
	
		
			
			|  | 20 | +        intitule    Varchar (150) NOT NULL ,
 | 
	
		
			
			|  | 21 | +        num_reponse TinyINT ,
 | 
	
		
			
			|  | 22 | +        reponse1    Varchar (50) ,
 | 
	
		
			
			|  | 23 | +        reponse2    Varchar (50) ,
 | 
	
		
			
			|  | 24 | +        PRIMARY KEY (intitule,reponse1,reponse2 )
 | 
	
		
			
			|  | 25 | +)ENGINE=InnoDB;
 | 
	
		
			
			| 26 | 26 |  
 | 
	
		
			
			| 27 |  | -CREATE TABLE scores (
 | 
	
		
			
			| 28 |  | -	login		VARCHAR(50) PRIMARY KEY,
 | 
	
		
			
			| 29 |  | -	score		INTEGER NOT NULL
 | 
	
		
			
			| 30 |  | -) ENGINE=INNODB;
 | 
	
		
			
			|  | 27 | +CREATE TABLE scores(
 | 
	
		
			
			|  | 28 | +        login Varchar (20) NOT NULL ,
 | 
	
		
			
			|  | 29 | +        score Int ,
 | 
	
		
			
			|  | 30 | +        PRIMARY KEY (login )
 | 
	
		
			
			|  | 31 | +)ENGINE=InnoDB;
 | 
	
		
			
			|  | 32 | +
 | 
	
		
			
			|  | 33 | +ALTER TABLE reponses ADD CONSTRAINT FK_Reponses_nom_cat FOREIGN KEY (nom_cat) REFERENCES categorie(nom_cat) ON DELETE CASCADE ON UPDATE CASCADE;
 | 
	
		
			
			|  | 34 | +ALTER TABLE questions ADD CONSTRAINT FK_Questions_reponse2 FOREIGN KEY (reponse2) REFERENCES reponses(reponse2) ON DELETE CASCADE ON UPDATE CASCADE;
 | 
	
		
			
			|  | 35 | +ALTER TABLE questions ADD CONSTRAINT FK_Questions_reponse1 FOREIGN KEY (reponse1) REFERENCES reponses(reponse1) ON DELETE CASCADE ON UPDATE CASCADE;
 |