SlideShare una empresa de Scribd logo
1 de 8
Descargar para leer sin conexión
“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
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'
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
3

RUT_FUNC    NOMBRE_FUNCIONARIO APELLIDO_FUNCIONARIO FECHA_P       FECHA_E
 123432124 Gustavo Eduardo     Montieal Villarroel   10/04/2011    21/04/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   12/04/2011    26/04/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   23/04/2011    02/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   25/04/2011    04/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   21/04/2011    05/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   20/04/2011    09/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   26/04/2011    02/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   02/05/2011    12/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   02/05/2011    09/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   02/05/2011    17/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   19/04/2011    04/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   02/05/2011    10/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   02/05/2011    12/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   25/04/2011    11/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   18/04/2011    02/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   02/05/2011    12/05/2011
 123453211 Raul Elias          Paredes Rios          02/05/2011    23/05/2011
 123432124 Gustavo Eduardo     Montieal Villarroel   25/04/2011    06/05/2011
 123453211 Raul Elias          Paredes Rios          25/04/2011    06/05/2011
 123453211 Raul Elias          Paredes Rios          12/04/2011    24/05/2011
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;
5

3a) Agregar un estudiante.
Insert into estudiantes (RUT_EST, NOMBRES, APELLIDOS, EDAD, FONO,
ID_CARRERA)
VALUES (156454567,'CAMILA ROCIO','PINO CATALAN',24,348621, 2);
commit;

Tabla:
     RUT_EST   NOMBRES                 APELLIDOS           EDAD    FONO     DIRECCION ID_CARRERA
1    165640276 MARIO ANDRES EWALDO     BORGEAUD BITTNER       22   236578                        2
2    161613940 ANTONIO ROBERTO         CANCINO MENESES        22   232323                        2
3    158847183 BARBARA KATHERINE       FLORES SAEZ            22   232323                        2
4    163203790 MARIA VALERIA           GROB DUHALDE           22   232323                        2
5    152927576 RODRGIO                 HUAQUIN                22   255252                        2
6    166863104 LEONEL ESTEBAN          GUEICHA GUEICHA        22   232323                        2
7    164609421 CRISTIAN MARCELO        GUINEO GUINEO          22   232323                        2
                                       HOFFMANN
8    157587978 RODRIGO ALBERTO         PROCHELLE              22   232323                        2
9    169226717 MAKARENA DEL CARMEN     JARA ARROYO            22   232323                        2
10   161612405 KARLA GUISELLE          KUNZ GRAU              22   232323                        2
11   168052600 YESSICA STEPHANIE       MELLA DELGADO          22   232323                        2
12   156007838 MARISA ALEJANDRA        MERA CARDENAS          22   232323                        2
13   165640802 DIEGO HERNAN            MORALES BARRIGA        22   232323                        2
14   140290777 JUAN SEBASTIAN          MUÑOZ FUENTES          22   232323                        2
15   161601985 DIEGO FERNANDO          NAUTO CALFUÑANCO       22   232323                        2
16   175355170 CRISTIAN EDUARDO        OBREQUE SOTO           22   232323                        2
17   163200295 RUMALDO JESUS           SALAZAR MITRE          22   232323                        2
18   165338090 PABLO                   TROMMER CARDENAS       22   232323                        2
19   166323347 PEDRO ALFONSO           ARAVENA BAYARD         22   212121                        1
20   124319790 LILIANA PAOLA           AROS SOLIS             22   212121                        1
                                       AVENDAÑO
21   201512646 ROXANA VALERIA          AVENDAÑO               22   212121                        1
22   168050380 CECILIA SOLEDAD         AYALA GUIÑEZ           22   212121                        1
23   165346114 JOHANNA KARINA          BASCUÑAN CASTILLO      22   212121                        1
24   160118644 EDUARDO ALEJANDRO       CID ESCOBAR            22   212121                        1
25   167499414 HANS ALEJANDRO          FRITZ MANGHI           22   212121                        1
26   168707240 CHRISTOPHER ALEJANDRO   FUENTES GARCIA         22   212121                        1
27   169516987 LUIS EDUARDO            GONZALEZ CARES         22   212121                        1
28   165415949 NATALY FABIOLA          IBAÑEZ JARAMILLO       22   212121                        1
29   155488557 ROXANA SARAI            JARPA JARAMILLO        22   212121                        1
30   168064802 EUGENIO NICOLAS         LOPEZ RAMOS            22   212121                        1
31   164648494 ELIZABETH ALEJANDRA     MUÑOZ MALDONADO        22   212121                        1
32   160114886 JORGE ENRIQUE           PACHECO ROSAS          22   212121                        1
33   168058039 PABLA MELISSA           RIVAS SALDIAS          22   212121                        1
34   159965260 YASNINA ARLENE          TORRES HEINZ           22   212121                        1
               CLAUDIA ANDREA
35   165633598 MARCELA                 TRONCOSO BRAVO         22   212121                        1
36   163192012 JOSE MARCO ANTONIO      VASQUEZ CEPEDA         22   212121                        1
37   164644901 LORENA DEL CARMEN       ZUÑIGA CATRILEF        22   212121                        1
38   163380595 VALENTINA               KONING                 23   233223                       19
39   163201518 Camila Rocio            Pino Catalan           24   348621                        2
6

2b) Que elimine el registro de un funcionario, teniendo como parámetro de entrada su
RUT.

DELETE
FROM funcionarios f
WHERE f.rut_func= 109878222;
commit;

Tabla:
     RUT_FUNC    NOMBRES          APELLIDOS             EDAD       DIRECCION          SALUD     ID_CAMPUS
1     123432124 Gustavo Eduardo   Montieal Villarroel          35 Picarte 3206        Fonasa                 2
2     123453211 Raul Elias        Paredes Rios                 46 Gral. Lagos 1452    Isapre                 1
4      87459535 Cristian Ramiro   Sepulveda Santana            33 Arauco 223          Isapre                 3


3c) Actualizar la información de un estudiante (edad, fono, dirección) conociendo su Rut.
Update estudiantes e
Set e.edad=22,
    e.fono= 234567,
    e.direccion='los caracoles 345'
Where e.rut_est=165640276;
  commit;

Tabla:
     RUT_EST     NOMBRES                         APELLIDOS                EDAD        FONO     DIRECCION         ID_CARRERA
1     165640276 MARIO ANDRES EWALDO              BORGEAUD BITTNER                22   234567 los caracoles 345            2
2     161613940 ANTONIO ROBERTO                  CANCINO MENESES                 27   232323                              2
3     158847183 BARBARA KATHERINE                FLORES SAEZ                     27   232323                              2
4     163203790 MARIA VALERIA                    GROB DUHALDE                    27   232323                              2
5     152927576 RODRGIO                          HUAQUIN                         27   255252                              2
6     166863104 LEONEL ESTEBAN                   GUEICHA GUEICHA                 27   232323                              2
7     164609421 CRISTIAN MARCELO                 GUINEO GUINEO                   27   232323                              2
                                                 HOFFMANN
8     157587978 RODRIGO ALBERTO                  PROCHELLE                       27   232323                              2
9     169226717 MAKARENA DEL CARMEN              JARA ARROYO                     27   232323                              2
10    161612405 KARLA GUISELLE                   KUNZ GRAU                       27   232323                              2
11    168052600 YESSICA STEPHANIE                MELLA DELGADO                   27   232323                              2
12    156007838 MARISA ALEJANDRA                 MERA CARDENAS                   27   232323                              2
13    165640802 DIEGO HERNAN                     MORALES BARRIGA                 27   232323                              2
14    140290777 JUAN SEBASTIAN                   MUÑOZ FUENTES                   27   232323                              2
15    161601985 DIEGO FERNANDO                   NAUTO CALFUÑANCO                27   232323                              2
16    175355170 CRISTIAN EDUARDO                 OBREQUE SOTO                    27   232323                              2
17    163200295 RUMALDO JESUS                    SALAZAR MITRE                   27   232323                              2
18    165338090 PABLO                            TROMMER CARDENAS                27   232323                              2
19    166323347 PEDRO ALFONSO                    ARAVENA BAYARD                  27   212121                              1
20    124319790 LILIANA PAOLA                    AROS SOLIS                      27   212121                              1
                                                 AVENDAÑO
21    201512646 ROXANA VALERIA                   AVENDAÑO                        27   212121                              1
22    168050380 CECILIA SOLEDAD                  AYALA GUIÑEZ                    27   212121                              1
23    165346114 JOHANNA KARINA                   BASCUÑAN CASTILLO               27   212121                              1
24    160118644 EDUARDO ALEJANDRO                CID ESCOBAR                     27   212121                              1
7

25   167499414 HANS ALEJANDRO          FRITZ MANGHI       27   212121        1
26   168707240 CHRISTOPHER ALEJANDRO   FUENTES GARCIA     27   212121        1
27   169516987 LUIS EDUARDO            GONZALEZ CARES     27   212121        1
28   165415949 NATALY FABIOLA          IBAÑEZ JARAMILLO   27   212121        1
29   155488557 ROXANA SARAI            JARPA JARAMILLO    27   212121        1
30   168064802 EUGENIO NICOLAS         LOPEZ RAMOS        27   212121        1
31   164648494 ELIZABETH ALEJANDRA     MUÑOZ MALDONADO    27   212121        1
32   160114886 JORGE ENRIQUE           PACHECO ROSAS      27   212121        1
33   168058039 PABLA MELISSA           RIVAS SALDIAS      27   212121        1
34   159965260 YASNINA ARLENE          TORRES HEINZ       27   212121        1
               CLAUDIA ANDREA
35   165633598 MARCELA                 TRONCOSO BRAVO     27   212121        1
36   163192012 JOSE MARCO ANTONIO      VASQUEZ CEPEDA     27   212121        1
37   164644901 LORENA DEL CARMEN       ZUÑIGA CATRILEF    27   212121        1
38   163380595 VALENTINA               KONING             27   233223       19
41   163201518 Camila Rocio            Pino Catalan       27   348621        2

Más contenido relacionado

Más de camilarocio

Laboratorio 2 parte 2
Laboratorio 2 parte 2Laboratorio 2 parte 2
Laboratorio 2 parte 2camilarocio
 
clasificacion de sistemas de informacion
clasificacion de sistemas de informacionclasificacion de sistemas de informacion
clasificacion de sistemas de informacioncamilarocio
 

Más de camilarocio (6)

Laboratorio 2 parte 2
Laboratorio 2 parte 2Laboratorio 2 parte 2
Laboratorio 2 parte 2
 
Laboratorio 2
Laboratorio 2Laboratorio 2
Laboratorio 2
 
laboratorio 1
laboratorio 1laboratorio 1
laboratorio 1
 
Tesina final
Tesina finalTesina final
Tesina final
 
Ergonomia
ErgonomiaErgonomia
Ergonomia
 
clasificacion de sistemas de informacion
clasificacion de sistemas de informacionclasificacion de sistemas de informacion
clasificacion de sistemas de informacion
 

Tarea3-PrestamosLibros

  • 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
  • 4. 3 RUT_FUNC NOMBRE_FUNCIONARIO APELLIDO_FUNCIONARIO FECHA_P FECHA_E 123432124 Gustavo Eduardo Montieal Villarroel 10/04/2011 21/04/2011 123432124 Gustavo Eduardo Montieal Villarroel 12/04/2011 26/04/2011 123432124 Gustavo Eduardo Montieal Villarroel 23/04/2011 02/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 25/04/2011 04/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 21/04/2011 05/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 20/04/2011 09/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 26/04/2011 02/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 02/05/2011 12/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 02/05/2011 09/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 02/05/2011 17/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 19/04/2011 04/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 02/05/2011 10/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 02/05/2011 12/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 25/04/2011 11/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 18/04/2011 02/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 02/05/2011 12/05/2011 123453211 Raul Elias Paredes Rios 02/05/2011 23/05/2011 123432124 Gustavo Eduardo Montieal Villarroel 25/04/2011 06/05/2011 123453211 Raul Elias Paredes Rios 25/04/2011 06/05/2011 123453211 Raul Elias Paredes Rios 12/04/2011 24/05/2011
  • 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;
  • 6. 5 3a) Agregar un estudiante. Insert into estudiantes (RUT_EST, NOMBRES, APELLIDOS, EDAD, FONO, ID_CARRERA) VALUES (156454567,'CAMILA ROCIO','PINO CATALAN',24,348621, 2); commit; Tabla: RUT_EST NOMBRES APELLIDOS EDAD FONO DIRECCION ID_CARRERA 1 165640276 MARIO ANDRES EWALDO BORGEAUD BITTNER 22 236578 2 2 161613940 ANTONIO ROBERTO CANCINO MENESES 22 232323 2 3 158847183 BARBARA KATHERINE FLORES SAEZ 22 232323 2 4 163203790 MARIA VALERIA GROB DUHALDE 22 232323 2 5 152927576 RODRGIO HUAQUIN 22 255252 2 6 166863104 LEONEL ESTEBAN GUEICHA GUEICHA 22 232323 2 7 164609421 CRISTIAN MARCELO GUINEO GUINEO 22 232323 2 HOFFMANN 8 157587978 RODRIGO ALBERTO PROCHELLE 22 232323 2 9 169226717 MAKARENA DEL CARMEN JARA ARROYO 22 232323 2 10 161612405 KARLA GUISELLE KUNZ GRAU 22 232323 2 11 168052600 YESSICA STEPHANIE MELLA DELGADO 22 232323 2 12 156007838 MARISA ALEJANDRA MERA CARDENAS 22 232323 2 13 165640802 DIEGO HERNAN MORALES BARRIGA 22 232323 2 14 140290777 JUAN SEBASTIAN MUÑOZ FUENTES 22 232323 2 15 161601985 DIEGO FERNANDO NAUTO CALFUÑANCO 22 232323 2 16 175355170 CRISTIAN EDUARDO OBREQUE SOTO 22 232323 2 17 163200295 RUMALDO JESUS SALAZAR MITRE 22 232323 2 18 165338090 PABLO TROMMER CARDENAS 22 232323 2 19 166323347 PEDRO ALFONSO ARAVENA BAYARD 22 212121 1 20 124319790 LILIANA PAOLA AROS SOLIS 22 212121 1 AVENDAÑO 21 201512646 ROXANA VALERIA AVENDAÑO 22 212121 1 22 168050380 CECILIA SOLEDAD AYALA GUIÑEZ 22 212121 1 23 165346114 JOHANNA KARINA BASCUÑAN CASTILLO 22 212121 1 24 160118644 EDUARDO ALEJANDRO CID ESCOBAR 22 212121 1 25 167499414 HANS ALEJANDRO FRITZ MANGHI 22 212121 1 26 168707240 CHRISTOPHER ALEJANDRO FUENTES GARCIA 22 212121 1 27 169516987 LUIS EDUARDO GONZALEZ CARES 22 212121 1 28 165415949 NATALY FABIOLA IBAÑEZ JARAMILLO 22 212121 1 29 155488557 ROXANA SARAI JARPA JARAMILLO 22 212121 1 30 168064802 EUGENIO NICOLAS LOPEZ RAMOS 22 212121 1 31 164648494 ELIZABETH ALEJANDRA MUÑOZ MALDONADO 22 212121 1 32 160114886 JORGE ENRIQUE PACHECO ROSAS 22 212121 1 33 168058039 PABLA MELISSA RIVAS SALDIAS 22 212121 1 34 159965260 YASNINA ARLENE TORRES HEINZ 22 212121 1 CLAUDIA ANDREA 35 165633598 MARCELA TRONCOSO BRAVO 22 212121 1 36 163192012 JOSE MARCO ANTONIO VASQUEZ CEPEDA 22 212121 1 37 164644901 LORENA DEL CARMEN ZUÑIGA CATRILEF 22 212121 1 38 163380595 VALENTINA KONING 23 233223 19 39 163201518 Camila Rocio Pino Catalan 24 348621 2
  • 7. 6 2b) Que elimine el registro de un funcionario, teniendo como parámetro de entrada su RUT. DELETE FROM funcionarios f WHERE f.rut_func= 109878222; commit; Tabla: RUT_FUNC NOMBRES APELLIDOS EDAD DIRECCION SALUD ID_CAMPUS 1 123432124 Gustavo Eduardo Montieal Villarroel 35 Picarte 3206 Fonasa 2 2 123453211 Raul Elias Paredes Rios 46 Gral. Lagos 1452 Isapre 1 4 87459535 Cristian Ramiro Sepulveda Santana 33 Arauco 223 Isapre 3 3c) Actualizar la información de un estudiante (edad, fono, dirección) conociendo su Rut. Update estudiantes e Set e.edad=22, e.fono= 234567, e.direccion='los caracoles 345' Where e.rut_est=165640276; commit; Tabla: RUT_EST NOMBRES APELLIDOS EDAD FONO DIRECCION ID_CARRERA 1 165640276 MARIO ANDRES EWALDO BORGEAUD BITTNER 22 234567 los caracoles 345 2 2 161613940 ANTONIO ROBERTO CANCINO MENESES 27 232323 2 3 158847183 BARBARA KATHERINE FLORES SAEZ 27 232323 2 4 163203790 MARIA VALERIA GROB DUHALDE 27 232323 2 5 152927576 RODRGIO HUAQUIN 27 255252 2 6 166863104 LEONEL ESTEBAN GUEICHA GUEICHA 27 232323 2 7 164609421 CRISTIAN MARCELO GUINEO GUINEO 27 232323 2 HOFFMANN 8 157587978 RODRIGO ALBERTO PROCHELLE 27 232323 2 9 169226717 MAKARENA DEL CARMEN JARA ARROYO 27 232323 2 10 161612405 KARLA GUISELLE KUNZ GRAU 27 232323 2 11 168052600 YESSICA STEPHANIE MELLA DELGADO 27 232323 2 12 156007838 MARISA ALEJANDRA MERA CARDENAS 27 232323 2 13 165640802 DIEGO HERNAN MORALES BARRIGA 27 232323 2 14 140290777 JUAN SEBASTIAN MUÑOZ FUENTES 27 232323 2 15 161601985 DIEGO FERNANDO NAUTO CALFUÑANCO 27 232323 2 16 175355170 CRISTIAN EDUARDO OBREQUE SOTO 27 232323 2 17 163200295 RUMALDO JESUS SALAZAR MITRE 27 232323 2 18 165338090 PABLO TROMMER CARDENAS 27 232323 2 19 166323347 PEDRO ALFONSO ARAVENA BAYARD 27 212121 1 20 124319790 LILIANA PAOLA AROS SOLIS 27 212121 1 AVENDAÑO 21 201512646 ROXANA VALERIA AVENDAÑO 27 212121 1 22 168050380 CECILIA SOLEDAD AYALA GUIÑEZ 27 212121 1 23 165346114 JOHANNA KARINA BASCUÑAN CASTILLO 27 212121 1 24 160118644 EDUARDO ALEJANDRO CID ESCOBAR 27 212121 1
  • 8. 7 25 167499414 HANS ALEJANDRO FRITZ MANGHI 27 212121 1 26 168707240 CHRISTOPHER ALEJANDRO FUENTES GARCIA 27 212121 1 27 169516987 LUIS EDUARDO GONZALEZ CARES 27 212121 1 28 165415949 NATALY FABIOLA IBAÑEZ JARAMILLO 27 212121 1 29 155488557 ROXANA SARAI JARPA JARAMILLO 27 212121 1 30 168064802 EUGENIO NICOLAS LOPEZ RAMOS 27 212121 1 31 164648494 ELIZABETH ALEJANDRA MUÑOZ MALDONADO 27 212121 1 32 160114886 JORGE ENRIQUE PACHECO ROSAS 27 212121 1 33 168058039 PABLA MELISSA RIVAS SALDIAS 27 212121 1 34 159965260 YASNINA ARLENE TORRES HEINZ 27 212121 1 CLAUDIA ANDREA 35 165633598 MARCELA TRONCOSO BRAVO 27 212121 1 36 163192012 JOSE MARCO ANTONIO VASQUEZ CEPEDA 27 212121 1 37 164644901 LORENA DEL CARMEN ZUÑIGA CATRILEF 27 212121 1 38 163380595 VALENTINA KONING 27 233223 19 41 163201518 Camila Rocio Pino Catalan 27 348621 2