This repository has been archived by the owner on Dec 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQL_BASEDATOS_SISCOM.sql
312 lines (293 loc) · 19.1 KB
/
SQL_BASEDATOS_SISCOM.sql
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
CREATE TABLE IF NOT EXISTS horario(
dia VARCHAR(10) not null,
hora time not null,
PRIMARY KEY(dia,hora)
);
CREATE TABLE IF NOT EXISTS postulante(
matricula int(10) not null,
nombre VARCHAR(50) not null,
correo VARCHAR(15) not null,
PRIMARY KEY(matricula)
);
CREATE TABLE IF NOT EXISTS profesor(
rut varchar(12) not null,
nombre varchar(50) not null,
PRIMARY KEY(rut)
);
CREATE TABLE IF NOT EXISTS ramo(
codigo varchar(8) not null,
nombre varchar(50) not null,
PRIMARY KEY(codigo)
);
CREATE TABLE IF NOT EXISTS semestre(
codigo varchar(6) not null,
PRIMARY KEY(codigo)
);
CREATE TABLE IF NOT EXISTS postula(
matricula int(10) NOT null,
codigo varchar(8) not null,
solicitado char not null,
seleccionado char not null,
PRIMARY KEY(codigo,matricula),
FOREIGN KEY(matricula) references postulante(matricula),
FOREIGN KEY(codigo) references ramo(codigo)
);
CREATE TABLE IF NOT EXISTS dicta(
codigo varchar(8) not null,
rut varchar(12) not null,
codigo_semestre varchar(8) not null,
PRIMARY KEY(codigo,rut),
FOREIGN KEY(codigo) references ramo(codigo),
FOREIGN KEY(rut) references profesor(rut),
FOREIGN KEY(codigo_semestre) references semestre(codigo)
);
CREATE TABLE IF NOT EXISTS ayudo(
matricula int(10) not null,
codigo varchar(8) not null,
codigo_semestre varchar(6) not null,
PRIMARY KEY(matricula,codigo,codigo_semestre),
FOREIGN KEY(matricula) references postulante(matricula),
FOREIGN KEY(codigo) references ramo(codigo),
FOREIGN KEY(codigo_semestre) references semestre(codigo)
);
CREATE TABLE IF NOT EXISTS curso(
matricula int(10) not null,
codigo varchar(8) not null,
calificacion varchar(3) not null,
PRIMARY KEY(matricula,codigo,calificacion),
FOREIGN KEY(matricula) references postulante(matricula),
FOREIGN KEY(codigo) references ramo(codigo)
);
CREATE TABLE IF NOT EXISTS tiene(
codigo varchar(8) not null,
dia VARCHAR(10) not null,
hora time not null,
PRIMARY KEY(codigo,dia,hora),
FOREIGN KEY(dia,hora) references horario(dia,hora),
FOREIGN KEY(codigo) references ramo(codigo)
);
CREATE TABLE IF NOT EXISTS dispone(
matricula int(10) not null,
dia VARCHAR(10) not null,
hora time not null,
PRIMARY KEY(matricula,dia,hora),
FOREIGN KEY(dia,hora) references horario(dia,hora),
FOREIGN KEY(matricula) references postulante(matricula)
);
INSERT INTO horario(dia, hora) VALUES ('LUNES','08:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','09:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','10:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','11:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','12:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','13:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','14:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','15:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','16:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','17:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','18:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','19:15:00');
INSERT INTO horario(dia, hora) VALUES ('LUNES','20:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','08:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','09:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','10:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','11:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','12:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','13:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','14:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','15:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','16:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','17:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','18:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','19:15:00');
INSERT INTO horario(dia, hora) VALUES ('MARTES','20:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','08:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','09:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','10:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','11:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','12:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','13:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','14:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','15:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','16:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','17:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','18:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','19:15:00');
INSERT INTO horario(dia, hora) VALUES ('MIERCOLES','20:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','08:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','09:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','10:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','11:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','12:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','13:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','14:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','15:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','16:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','17:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','18:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','19:15:00');
INSERT INTO horario(dia, hora) VALUES ('JUEVES','20:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','08:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','09:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','10:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','11:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','12:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','13:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','14:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','15:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','16:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','17:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','18:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','19:15:00');
INSERT INTO horario(dia, hora) VALUES ('VIERNES','20:15:00');
INSERT INTO postulante(matricula, nombre, correo) VALUES ('2013429359','Sebastián Moraga Scheuermann','smoraga'),
('2013459916','Isabel Donoso Leiva','idonoso'),
('2012000000','Katerin De la Hoz','kdelahoz'),
('2014000000','Gonzalo Benavides García','gbenavides'),
('2001696969','Jorge Nitales','jnitales');
INSERT INTO profesor(rut, nombre) VALUES ('15.555.555-5','Maike Litoris'),
('16.666.666-5','Patricio Carlos Agusto'),
('17.777.777-7','Aquiles Castro'),
('18.648.241-k','Stephanie Caro Torres'),
('21.696.969-1','Alberto Catesta'),
('14.555.555-5','Juan Cardenas C'),
('18.188.888-8','M. WALLACE'),
('18.288.888-8','Leonel Badilla Araya'),
('18.388.888-8','M. CAMPOS'),
('18.488.888-8','J. AGUIRRE'),
('18.588.888-8','Felipe Portales Oliva'),
('18.688.888-8','Jorge L. Delgado Morales'),
('18.688.888-3','Jorge Avila Cartes'),
('18.788.888-8','Elias Fierro Antipi'),
('18.555.888-8','Bruno Karelovic Burotto'),
('18.138.888-8','Francisco Cala R.'),
('18.148.888-8','L. NEIRA');
INSERT INTO ramo(codigo, nombre) VALUES ('520145-1','INTRODUCCION A LA MATEMÁTICA UNIVERSITARIA'),
('520145-0','INTRODUCCION A LA MATEMÁTICA UNIVERSITARIA'),
('523240-0','MET. CUANTITATIVOS I'),
('525117-0','CALCULO'),
('525157-0','CALCULO I'),
('525157-1','CALCULO I'),
('525221-0','ECUCIONES DIFERENCIALES ORDINARIAS'),
('510145-0','INTRODUCCION A LA FISICA UNIVERSITARIA'),
('510145-1','INTRODUCCION A LA FISICA UNIVERSITARIA'),
('510145-2','INTRODUCCION A LA FISICA UNIVERSITARIA'),
('510145-3','INTRODUCCION A LA FISICA UNIVERSITARIA'),
('525147-1','ALGEBRA I'),
('525147-2','ALGEBRA I'),
('525147-3','ALGEBRA I'),
('525155-0','ALGEBRA I'),
('525155-1','ALGEBRA I'),
('525211-0','CALCULO III');
INSERT INTO semestre(codigo) VALUES ('2018-1'),('2018-2'),('2017-1'),('2017-2'),('2016-1'),('2016-2'),('2015-1'),('2015-2');
INSERT INTO postula(matricula,codigo,solicitado,seleccionado) VALUES ('2013429359','520145-0','0','0'),
('2013429359','525211-0','0','0'),
('2013429359','525221-0','0','0'),
('2013459916','520145-1','0','0'),
('2013459916','523240-0','0','0'),
('2013459916','525117-0','0','0'),
('2012000000','525157-0','0','0'),
('2012000000','525157-1','0','0'),
('2012000000','525221-0','0','0'),
('2014000000','510145-0','0','0'),
('2014000000','525147-1','0','0'),
('2014000000','525147-2','0','0'),
('2001696969','510145-0','0','0'),
('2001696969','510145-1','0','0'),
('2001696969','520145-1','0','0');
INSERT INTO dicta(codigo,rut,codigo_semestre) VALUES ('520145-1','15.555.555-5','2018-1'),
('520145-0','18.188.888-8','2018-1'),
('523240-0','18.648.241-k','2018-1'),
('525117-0','18.388.888-8','2018-1'),
('525157-0','18.148.888-8','2018-1'),
('525157-1','21.696.969-1','2018-1'),
('525221-0','14.555.555-5','2018-1'),
('510145-0','18.488.888-8','2018-1'),
('510145-1','18.588.888-8','2018-1'),
('510145-2','18.688.888-8','2018-1'),
('510145-3','16.666.666-5','2018-1'),
('525147-1','14.555.555-5','2018-1'),
('525147-2','18.688.888-3','2018-1'),
('525147-3','18.555.888-8','2018-1'),
('525155-0','18.648.241-k','2018-1'),
('525155-1','18.288.888-8','2018-1'),
('525211-0','18.688.888-3','2018-1');
INSERT INTO ayudo(matricula, codigo,codigo_semestre) VALUES ('2013429359','520145-1','2016-1'),
('2013429359','525211-0','2017-1'),
('2013459916','520145-1','2015-1'),
('2012000000','525221-0','2015-2'),
('2014000000','525147-2','2017-1'),
('2001696969','525157-0','2015-1');
INSERT INTO curso(matricula,codigo,calificacion) VALUES ('2013429359','520145-1','6.1'),
('2013429359','525211-0','6.2'),
('2013459916','520145-1','5.5'),
('2012000000','525221-0','5.7'),
('2014000000','525147-2','5.6'),
('2001696969','525157-0','7.0');
INSERT INTO tiene(codigo,dia,hora) VALUES ('520145-1','MARTES','15:15:00'),
('520145-1','MARTES','16:15:00'),
('520145-0','MIERCOLES','15:15:00'),
('520145-0','MIERCOLES','16:15:00'),
('520145-1','JUEVES','15:15:00'),
('520145-1','JUEVES','16:15:00'),
('520145-0','JUEVES','17:15:00'),
('520145-0','JUEVES','18:15:00'),
('523240-0','MARTES','15:15:00'),
('523240-0','MARTES','16:15:00'),
('525117-0','MIERCOLES','15:15:00'),
('525117-0','MIERCOLES','16:15:00'),
('525157-0','JUEVES','15:15:00'),
('525157-0','JUEVES','16:15:00'),
('525157-1','JUEVES','17:15:00'),
('525157-1','JUEVES','18:15:00'),
('525221-0','MARTES','15:15:00'),
('525221-0','MARTES','16:15:00'),
('510145-0','MIERCOLES','15:15:00'),
('510145-0','MIERCOLES','16:15:00'),
('510145-1','JUEVES','15:15:00'),
('510145-1','JUEVES','16:15:00'),
('510145-2','JUEVES','17:15:00'),
('510145-2','JUEVES','18:15:00'),
('510145-3','MARTES','15:15:00'),
('510145-3','MARTES','16:15:00'),
('525147-1','MIERCOLES','15:15:00'),
('525147-1','MIERCOLES','16:15:00'),
('525147-2','JUEVES','15:15:00'),
('525147-2','JUEVES','16:15:00'),
('525147-3','JUEVES','17:15:00'),
('525147-3','JUEVES','18:15:00'),
('525155-0','MARTES','15:15:00'),
('525155-0','MARTES','16:15:00'),
('525155-1','MIERCOLES','15:15:00'),
('525155-1','MIERCOLES','16:15:00'),
('525211-0','VIERNES','15:15:00'),
('525211-0','VIERNES','16:15:00');
INSERT INTO dispone(matricula,dia,hora) VALUES ('2013429359','MARTES','15:15:00'),
('2013429359','MARTES','16:15:00'),
('2013429359','MIERCOLES','16:15:00'),
('2013429359','MIERCOLES','17:15:00'),
('2013429359','VIERNES','15:15:00'),
('2013429359','VIERNES','16:15:00'),
('2013459916','MARTES','15:15:00'),
('2013459916','MARTES','16:15:00'),
('2013459916','MIERCOLES','17:15:00'),
('2013459916','MIERCOLES','18:15:00'),
('2013459916','JUEVES','17:15:00'),
('2013459916','JUEVES','18:15:00'),
('2012000000','LUNES','15:15:00'),
('2012000000','LUNES','16:15:00'),
('2012000000','MIERCOLES','17:15:00'),
('2012000000','MIERCOLES','18:15:00'),
('2012000000','JUEVES','17:15:00'),
('2012000000','JUEVES','18:15:00'),
('2014000000','MARTES','15:15:00'),
('2014000000','MARTES','16:15:00'),
('2014000000','MIERCOLES','17:15:00'),
('2014000000','MIERCOLES','18:15:00'),
('2014000000','JUEVES','17:15:00'),
('2014000000','JUEVES','18:15:00'),
('2001696969','MARTES','15:15:00'),
('2001696969','MARTES','16:15:00'),
('2001696969','MIERCOLES','17:15:00'),
('2001696969','MIERCOLES','18:15:00'),
('2001696969','JUEVES','17:15:00'),
('2001696969','JUEVES','18:15:00');