1. “Tarea 3”
Ayudantía
Sistemas de Información Empresarial
Profesor : Cristian Salazar C.
Alumnas : Jimena Ordenes R.
Camila Pino C.
Carolina Vásquez C.
Valdivia, 30 de mayo de 2011
2. 1
1) Creación de la Vista
Create or replace view vista_tarea3 as
Select e.rut_est,
e.nombres as "NOMBRE_ESTUDIANTE",
e.apellidos as "APELLIDO_ESTUDIANTE",
c.nombre as "NOMBRE_CARRERA",
l.cod_libro
l.titulo,
l.agno as "AÑO",
a.nombres as "NOMBRE_AUTOR",
a.apellidos as "APELLIDO_AUTOR)",
ed.nombre as "NOMBRE_EDITORIAL",
ed.pais,
f.rut_func,
f.nombres as "NOMBRE_FUNCIONARIO",
f.apellidos as "APELLIDO_FUNCIONARIO",
p.fecha_p,
p.fecha_e
From estudiantes e,
prestamo p,
carreras c,
libros l,
editoriales ed,
autores a,
funcionarios f,
biblioteca b,
tipo t
where e.rut_est=p.rut_est
and c.id_carrera=e.id_carrera
and p.cod_libro=l.cod_libro
and p.rut_func=f.rut_func
and l.id_tipo=t.id_tipo
and l.id_biblio=b.id_biblio
and l.rut_autor=a.rut_autor
and l.id_edit= ed.id_edit
and p.fecha_e <='02/05/2011'
3. 2
Tabla:
RUT_EST NOMBRE_ESTUDIANTE APELLIDO_ESTUDIANTE NOMBRE_CARRERA COD_LIBRO
1 124319790 LILIANA PAOLA AROS SOLIS Auditoria 10
2 140290777 JUAN SEBASTIAN MUÑOZ FUENTES Ing. Comercial 10
3 152927576 RODRGIO HUAQUIN Ing. Comercial 10
4 155488557 ROXANA SARAI JARPA JARAMILLO Auditoria 20
5 201512646 ROXANA VALERIA AVENDAÑO AVENDAÑO Auditoria 10
6 169516987 LUIS EDUARDO GONZALEZ CARES Auditoria 40
7 165640276 MARIO ANDRES EWALDO BORGEAUD BITTNER Ing. Comercial 50
CLAUDIA ANDREA
8 165633598 MARCELA TRONCOSO BRAVO Auditoria 60
9 165346114 JOHANNA KARINA BASCUÑAN CASTILLO Auditoria 50
10 168064802 EUGENIO NICOLAS LOPEZ RAMOS Auditoria 40
11 168050380 CECILIA SOLEDAD AYALA GUIÑEZ Auditoria 10
12 161612405 KARLA GUISELLE KUNZ GRAU Ing. Comercial 20
13 161613940 ANTONIO ROBERTO CANCINO MENESES Ing. Comercial 40
14 164609421 CRISTIAN MARCELO GUINEO GUINEO Ing. Comercial 50
15 169226717 MAKARENA DEL CARMEN JARA ARROYO Ing. Comercial 60
16 165640276 MARIO ANDRES EWALDO BORGEAUD BITTNER Ing. Comercial 20
17 163380595 VALENTINA KONING Ing. Civil en Informática 50
18 124319790 LILIANA PAOLA AROS SOLIS Auditoria 20
19 124319790 LILIANA PAOLA AROS SOLIS Auditoria 10
20 124319790 LILIANA PAOLA AROS SOLIS Auditoria 20
TITULO AÑO NOMBRE_AUTOR APELLIDO_AUTOR NOMBRE_EDITORIAL PAIS
Excel Avanzado 2002 Claudio Sanchez Oceano Chile
Excel Avanzado 2002 Claudio Sanchez Oceano Chile
Excel Avanzado 2002 Claudio Sanchez Oceano Chile
Excel Básico 2004 Claudio Sanchez Universitaria Chile
Excel Avanzado 2002 Claudio Sanchez Oceano Chile
Economia 2005 Ramon Picarte Achievement Publishing, Inc. Estados Unidos
100 Reflexiones para Amara y Servir 2002 Juan Perez Libart Ltda. Chile
Confieso que he vivido - Neruda 2000 Ramon Picarte Libromar Chile
100 Reflexiones para Amara y Servir 2002 Juan Perez Libart Ltda. Chile
Economia 2005 Ramon Picarte Achievement Publishing, Inc. Estados Unidos
Excel Avanzado 2002 Claudio Sanchez Oceano Chile
Excel Básico 2004 Claudio Sanchez Universitaria Chile
Economia 2005 Ramon Picarte Achievement Publishing, Inc. Estados Unidos
100 Reflexiones para Amara y Servir 2002 Juan Perez Libart Ltda. Chile
Confieso que he vivido - Neruda 2000 Ramon Picarte Libromar Chile
Excel Básico 2004 Claudio Sanchez Universitaria Chile
100 Reflexiones para Amara y Servir 2002 Juan Perez Libart Ltda. Chile
Excel Básico 2004 Claudio Sanchez Universitaria Chile
Excel Avanzado 2002 Claudio Sanchez Oceano Chile
Excel Básico 2004 Claudio Sanchez Universitaria Chile
5. 4
2a) función que entregue el numero de estudiantes de Auditoria y Ing. Comercial
Create or replace function prueba2 (a number)
Return integer is
Result integer ;
Begin
Select count(e.rut_est) into result
From estudiantes e,
carreras c
Where c.id_carrera=e.id_carrera
And (c.id_carrera= 1
Or c.id_carrera= 2);
Return(Result);
End prueba2;
2b) función que entregue el numero de veces que se ha prestado un libro a un estudiante,
entre un rango de fechas.
Create or replace function prueba3(rut_estudiante in number, codigo_libro in number,
fecha1 date,fecha2 date )
Return number is
Result number;
Begin
Select count(*)into result
From estudiantes e,
libros l,
prestamo p
Where e.rut_est=p.rut_est
And p.cod_libro=l.cod_libro
And e.rut_est= rut_estudiante
And l.cod_libro= codigo_libro;
Return(Result);
End prueba3;