Advertisement
Gustavo_Inzunza

sql

Sep 6th, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. /*
  2. problema1
  3. select al.rut,al.nombre_alum,count(*)as cantidad
  4. from alumno al, inscribe ins
  5. where al.rut=ins.rut
  6. group by al.rut,al.nombre_alum*/
  7. --problema 2
  8. --select nombre_asig from asignatura where creditos=(select max(asi.creditos)as maximo from asignatura asi);
  9. --problema 3
  10. --select distinct asi.nombre_asig from asignatura asi,alumno al,inscribe ins,carrera car
  11. --where al.rut=ins.rut and asi.cod_asignatura=ins.cod_asignatura and car.cod_carrera=al.cod_carrera
  12. --and al.cod_carrera=(select cod_carrera from carrera where nombre_carrera='arquitectura');
  13. --problema 4
  14. --select ins.rut,al.nombre_alum,count(*) as cantidad from alumno al,asignatura asi,inscribe ins
  15. --where al.rut=ins.rut and asi.cod_asignatura=ins.cod_asignatura
  16. --group by ins.rut,al.nombre_alum having count(*)>2;
  17. --prblema 5
  18. --select avg(asi.creditos) as promedio_creditos from asignatura asi;
  19. --problema 6
  20. --select prof.rut_p,count(*) as cantidad_asig from profesor prof, dicta dic where prof.rut_p=dic.rut_p group by prof.rut_p;
  21. --problema 7
  22. select /*prof.rut_p,*/dep.nombre_depto,count(*) as cantidad_profesores from departamento dep, profesor prof
  23. where dep.cod_depto=prof.cod_depto
  24. group by prof.rut_p,dep.nombre_depto,prof.cod_depto;
  25. --problema8 (incompleto)
  26. --select nombre_profe from profesor where edad=(select max(prof.edad)as edad from profesor prof);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement