Examen
- 1. Select* fromcustomer;
--
-- PrimeraPregunta
--
Select* fromcustomer;
selecta.first_name asNombre,a.last_name asApellido,c.cityasCiudad,d.countryasPais
fromcustomera, addressb,city c, countryd
where b.address_id=a.address_idand c.city_id=b.city_idandd.country_id=c.country_idand
a.customer_id=6;
--
-- SegundaPregunta
--
select* fromcountry;
selectcity.cityfromcitywhere city=602;
select*fromcity;
SET AUTOCOMMIT=0;
INSERT INTOcityVALUES (602,'Quito',28,'2006-02-15 04:57:20');
COMMIT;
select* fromaddress;
SET AUTOCOMMIT=0;
INSERT INTOaddressVALUES(606,'Rosales','Villa','Valle',602,'12345','220605','2006-02-15
04:57:20');
COMMIT;
SET AUTOCOMMIT=0;
- 2. INSERT INTOcustomerVALUES
(1,1,'Pepito','Ortega','pepito.ortega@sakila1customer.org',606,1,'2006-02-14 22:04:36','2006-
02-15 04:57:20');
COMMIT;
--
-- Tercera Pregunta
--
Select* fromcustomer;
selecta.first_name asNombre,a.last_name asApellido,d.Title asTitulo,e.name asLenguaje
fromcustomera, rental b, inventoryc,filmd,language e
where a.customer_id=b.customer_idandb.inventory_id=c.inventory_idand
c.film_id=d.film_idandd.language_id=e.language_idanda.customer_id=89;
--
-- Cuarta Pregunta
--
create table if not existsEstudiante(
Cod_Estudiante INT,
nombre_est varchar(20),
apellido_est varchar(20),
Cod_TutorfkINT,
PRIMARY KEY(Cod_Estudiante),
foreignkey(Cod_Tutorfk) referencestutor(Cod_Tutor));
create table if not existsTutor(
Cod_Tutor INT,
nombre_t varchar(20),