/* @pregSimple_UZ.sql */ SET ECHO ON /* creación de una vista con total horas impartidas por profesor */ CREATE VIEW totHorasProf (clvProf, ttHT, ttHP) AS SELECT clvProf, sum(HT), sum(HP) FROM ImparteAsign GROUP BY clvProf; /* listado de los profesores (clave y nombre), y el total horas impartidas */ SELECT Profesor.clvProf, nombProf, ttHT "h. Teoría", ttHP "h. Prácticas" FROM Profesor, totHorasProf WHERE Profesor.clvProf = totHorasProf.clvProf; /* eliminación de la vista creada */ DROP VIEW totHorasProf;