Blame view

bdd.sql 1.45 KB
564557d2   lwadbled   add(bdd.sql): Fic...
1
2
3
4
5
6
  /* Fichier de création des informations de la BDD */
  
  /* Suppression des vues si elles existent */
  
  /* Suppression des tables si elles existent */
  
564557d2   lwadbled   add(bdd.sql): Fic...
7
  drop table if exists reservation ;
b12775c2   lwadbled   fix(): resolution...
8
9
  drop table if exists equipement ;
  drop table if exists banc ;
da5d2b56   lwadbled   feat(Matrice): pe...
10
  drop table if exists equip_type ;
b12775c2   lwadbled   fix(): resolution...
11
12
  drop table if exists creneau ;
  drop table if exists utilisateur ;
564557d2   lwadbled   add(bdd.sql): Fic...
13
14
15
16
17
18
19
20
  
  /* Creation des tables pour l'interface Web */
  
  create table utilisateur
  	(LOGIN char(8) PRIMARY KEY,
  	 MDP char(20));
  
  create table creneau
b12775c2   lwadbled   fix(): resolution...
21
  	(JOUR date PRIMARY KEY);
564557d2   lwadbled   add(bdd.sql): Fic...
22
23
24
25
  
  create table banc
  	(NUMERO int PRIMARY KEY);
  
da5d2b56   lwadbled   feat(Matrice): pe...
26
27
28
  create table equip_type
  	(TYPE char(30) PRIMARY KEY);
  
564557d2   lwadbled   add(bdd.sql): Fic...
29
  create table equipement
b12775c2   lwadbled   fix(): resolution...
30
  	(numero int REFERENCES banc,
df46a0de   lwadbled   fix(bdd.sql): ajo...
31
  	 IP char(15) PRIMARY KEY,
564557d2   lwadbled   add(bdd.sql): Fic...
32
  	 NOM char(50),
da5d2b56   lwadbled   feat(Matrice): pe...
33
  	 type char(30) REFERENCES equip_type);
564557d2   lwadbled   add(bdd.sql): Fic...
34
35
  
  create table reservation
b12775c2   lwadbled   fix(): resolution...
36
37
38
  	(numero int REFERENCES banc,
  	 jour date REFERENCES creneau,
  	 login char(8) REFERENCES utilisateur,
564557d2   lwadbled   add(bdd.sql): Fic...
39
40
  	 HEUREDEBUT char(5),
  	 HEUREFIN char(5),
87d5afd9   lwadbled   feat(*): verifica...
41
  	 /*UNIQUE(moment,HEUREDEBUT),*/
b12775c2   lwadbled   fix(): resolution...
42
  	 PRIMARY KEY(numero,jour,HEUREDEBUT));
564557d2   lwadbled   add(bdd.sql): Fic...
43
44
45
46
  
  /* Insertions des donnees dans la BDD */
  
  insert into utilisateur values ('lwadbled','Louis');
46de4374   lwadbled   feat(gestionAppar...
47
  insert into utilisateur values ('admin','glopglop');
564557d2   lwadbled   add(bdd.sql): Fic...
48
  
b12775c2   lwadbled   fix(): resolution...
49
  insert into creneau values (01/12/2021);
564557d2   lwadbled   add(bdd.sql): Fic...
50
  
da5d2b56   lwadbled   feat(Matrice): pe...
51
52
53
54
55
  insert into equip_type values ("Oscilloscope");
  insert into equip_type values ("Generateur");
  insert into equip_type values ("Matrice");
  insert into equip_type values ("Multimetre");
  
564557d2   lwadbled   add(bdd.sql): Fic...
56
57
58
  insert into banc values (1);
  
  /* Creation des vues pour faciliter l'utilisation de la BDD sur l'interface Web */