1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
   | /*CREATION DE LA BASE DE DONNE BD_ENSEIGNEMENT*/
 
/*drop database is exists BD_ENSEIGNEMENT;
create database BD_ENSEIGNEMENT;*/
 
/* L'UTILISATION DE LA BASE DE DONNE BD_ENSEIGNEMENT*/
use BD_ENSEIGNEMENT;
 
 
/* CREATION DE LA TABLE CLASSE*/
drop table if exists classe;
create table classe
	(
		CodClas		varchar(5),
		LibClas		varchar(20)
	)ENGINE = InnoDB, CHARSET = utf8;
 
/* CREATION DE LA TABLE ELEVE*/
drop table if exists eleve;
create table eleve
	(
		NumElev 	int(4) not null auto_increment,
		NomElev 	varchar(20),
		PrenElev 	varchar(20),
		DateElev 	date,
		AdrElev 	varchar(25),
		TelElev 	varchar(8),
		CodClas		varchar(5),
		constraint pk_eleve primary key (NumElev),
		constraint fk_classe foreign key (CodClas) references classe(CodClas)
	)ENGINE=InnoDB, CHARSET=utf8;
 
 
/*CREATION DE LA TABLE MATIERE*/
drop table if exists matiere;
create table matiere
	(
		CodMat		int(5) primary key,
		LibMat		varchar(20)
	)ENGINE = InnoDB, CHARSET = utf8;
 
 
 
/* CREATION DE LA TABLE ENSEIGNANT*/
drop table if exists enseignant;
create table enseignant
	(
		CinEns		int(8),
		NomEns		varchar(20),
		PrenEns		varchar(20),
		TelEns		varchar(8),
		AdrEns		varchar(25),
		CodMat		int(5),
		constraint pk_ens primary key (CinEns),
		constraint fk_mat foreign key (CodMat)references matiere(CodMat)
	)ENGINE = InnoDB, CHARSET = utf8;
 
 
/*	CREATION DE LA TABLE SEANCE */
drop table if exists seance;
create table seance
	(
		NumSea		int(5),
		DurSea		int(2),
		JourSea		varchar(10),
		HeurDebSea	varchar(5),
		CodClas		int(5),
		CinEns		int(8),
		constraint pk_sea primary key (NumSea),
		constraint fk_clas foreign key (CodClas)references classe(CodClas),
		constraint fk_enseig foreign key (CinEns)references enseignant(CinEns)
	)ENGINE = InnoDB, CHARSET = utf8;
 
 
/* CREATION DE LA TABLE ABSENCE */
drop table if exists absence;
create table absence
	(
		NumElev		int(4),
		NumSea		int(2),
		constraint fk_elev foreign key(NumElev)references eleve(NumElev),
		constraint fk_sea foreign key(NumSea)references seance(NumSea)
	)ENGINE = InnoDB, CHARSET = utf8;  |