sábado, 12 de abril de 2014

Desarrollo taller Vistas

Profesor

Adjuntamos ejercicios de vistas solicitado en clases, correspondiente al grupo G:


/* VISTA SIMPLE */
create view udla_v_contratos (sal_con_numero, sal_con_tasa_actual)
as select con_numero, con_tasa_actual
from adm_contratos where con_numero =39792 ;


/* VISTA COMPLEJA */
create view udla_v_contratos_empresa (sal_con_numero, sal_con_tasa_actual, sal_nombre_empresa)
as
select cnt.con_numero, cnt.con_tasa_actual, emp.emp_razon_social
from adm_contratos cnt, adm_empresas  emp where
cnt.adh_rut = emp.emp_rut
and cnt.con_numero =39792 ;


/* VISTA SIMPLE  CON RESTRICCION*/
create or replace view udla_v_contratos_restriccion
as select *
from adm_contratos where con_numero = 5
with check option constraint conres_ck;


/* VISTA CON DENEGACION OPERACIONES  */
create view udla_v_contratos_read (sal_con_numero, sal_con_tasa_actual)
as select con_numero, con_tasa_actual
from adm_contratos where con_numero =39792
with read only;
 

/* ELIMINACION DE VISTA */
drop view udla_v_contratos;


/* INSERT DE VISTA */
insert into vista_empleados2 values('Juan Perez','m','Sistemas',2);


/* UPDATE DE VISTA */
update vista_empleados2 set nombre='Tomas' where nombre='Juan Perez';

No hay comentarios:

Publicar un comentario