Segundo Parcial


PARCIAL PARTE 1:

1. Visualizar los estudiantes con sus acudientes

ANALISIS

-Que deseo Mostrar:

  • Estudiante
  • Acudiente

-Tablas Involucradas

  • Estudiante
  • Acudiente
  • Estudiante_acudiente

Funcion a utilizar 

  • inner join

Relaciones

  • estudiante.codigo=estudiante_acudiente.cod_estudiante 
  • acudiente.codigo=estudiante_acudiente.Cod_acudiente 


Código: select estudiante.Nombre, Acudiente.nombre from estudiante inner join estudiante_acudiente on estudiante.codigo=estudiante_acudiente.cod_estudiante inner join acudiente on acudiente.codigo=estudiante_acudiente.Cod_acudiente;

RESULTADO


2. Que estudiantes no tienen acudiente asignado

ANALISIS

-Que deseo Mostrar:

  • Estudiante

-Tablas Involucradas

  • Estudiante
  • Acudiente
  • Estudiante_acudiente

Funcion a utilizar

  • left join

Condición

where estudiante_acudiente.cod_estudiante is null 

Relaciones

  • estudiante.codigo=estudiante_acudiente.cod_estudiante

 Codigo: select estudiante.nombre from estudiante left join estudiante_acudiente on estudiante.codigo=estudiante_acudiente.cod_estudiante where estudiante_acudiente.cod_estudiante is null;

NOTA: Todos los estudiantes tienen acudiente asignados.

4.Visualizar las materias que matriculó el estudiante 00001

ANALISIS

-Que deseo Mostrar:

  • Estudiante

-Tablas Involucradas

  • Estudiante
  • materia
  • Estudiante_materia


Condición

where estudiante.codigo = 001

Relaciones

  • estudiante.codigo=estudiante_materia.cod_estudiante
  • materia.codigo= estudiante_materia.cod_materia

Codigo: select estudiante.nombre,materia.materia from estudiante,materia,estudiante_materia where estudiante.codigo = 001 and estudiante.codigo=estudiante_materia.cod_estudiante and materia.codigo= estudiante_materia.cod_materia;

RESULTADO


5. Visualizar los estudiantes con las materias que matricularon

-Que deseo Mostrar:

  • Estudiante

-Tablas Involucradas

  • Estudiante
  • materia
  • Estudiante_materia

Funcion a utilizar

  • inner join

Relaciones

  • materia.codigo=estudiante_materia.cod_materia
  • estudiante.codigo=estudiante_materia.cod_estudiante

Codigo: select estudiante.nombre,materia.materia from materia inner join estudiante_materia on materia.codigo=estudiante_materia.cod_materia inner join estudiante on estudiante.codigo=estudiante_materia.cod_estudiante;

RESULTADO


8. Visualizar los docentes con las materias que dictan

Que deseo Mostrar:

  • Profesores
  • Materia

-Tablas Involucradas

  • Profesor
  • Materia 
  • Materia_Profesor

Funcion a utilizar

  • inner join

Relaciones

  • profesor.codigo=materia_profesor.cod_profesor
  • materia on materia.codigo=materia_profesor.cod_materia

Codigo: select profesor.nombre,materia.materia from profesor inner join materia_profesor on profesor.codigo=materia_profesor.cod_profesor inner join materia on materia.codigo=materia_profesor.cod_materia;

RESULTADO


11. Visualizar el estudiante con las materias que tiene matriculadas y que docentes las dicta.

Que deseo Mostrar:

  • Estudiante
  • Materia
  • Profesor

-Tablas Involucradas

  • Estudiante
  • Materia
  • Profesor
  • Estudiante_Materia

Funcion a utilizar

  • inner join

Relaciones

  • materia.codigo=estudiante_materia.cod_materia
  • estudiante.codigo=estudiante_materia.cod_estudiante 
  • profesor.codigo=estudiante_materia.cod_materia 

Código: select estudiante.nombre,materia.materia,profesor.nombre from materia inner join estudiante_materia on materia.codigo=estudiante_materia.cod_materia inner join estudiante on estudiante.codigo=estudiante_materia.cod_estudiante inner join profesor on profesor.codigo=estudiante_materia.cod_materia;

RESULTADO

NOTA: BASE DE DATOS SE ENCUENTRA EN LA ACTIVIDAD 2 DE ESTA PAGINA


PARCIAL PARTE2: 


1. Que profesores dictan la carrera ingeniería en sistemas:

ANALISIS

-Que deseo Mostrar:

  • -profesor.nombre
  • -carrera.carrera

-Tablas Involucradas

  • Profesor
  • Carrera
  • Profcar
-Condicion 

001 = Gente que estudia ingeniería de sistemas
where carrera.codcarre=001

-Relaciones

  • profesor.codprofe=profcar.codprofe 

  • carrera.codcarre=profcar.codcarre 


Código: select profesor.nombre,carrera.carrera from profesor,carrera,profcar where carrera.codcarre=001 and profesor.codprofe=profcar.codprofe and carrera.codcarre=profcar.codcarre;


Resultado:

2. Que alumnos están matriculados en la carrera de Derecho y cuales profesores dictan en esa carrera.

ANALISIS

-Que deseo Mostrar:

  • Alumno.nombre
  • Carrera.carrera
  • Profesor.nombre

-Tablas Involucradas

  • Alumno
  • Carrera
  • Profesor
  • Matricula

-Condicion 

004 = Gente que estudia Derecho
where matricula.codcarre=004

Relaciones

  • alumno.codestu = matricula.codestu
  • carrera.codcarre= matricula.codcarre 
  •  profesor.codprofe=matricula.codprofe

Código: select alumno.nombre,carrera.carrera,profesor.nombre from alumno,carrera,profesor,matricula where matricula.codcarre=004 and alumno.codestu = matricula.codestu and carrera.codcarre= matricula.codcarre and profesor.codprofe=matricula.codprofe;

RESULTADO:

3. Cuanto les costó el semestre de los alumnos que se matricularon en Veterinaria.

ANALISIS

-Que deseo Mostrar:

  • Alumno.nombre
  • Carrera.carrera
  • Matricula.valorsemestre

-Tablas Involucradas

  • Alumno
  • Carrera
  • Matricula

-Condicion 

008 = Gente que estudia Veterinaria
where matricula.codcarre=008

Relaciones

  • alumno.codestu=matricula.codestu
  • carrera.codcarre= matricula.codcarre 
Código: select alumno.nombre,carrera.carrera,matricula.valorsemestre from alumno,carrera,matricula where matricula.codcarre=008 and alumno.codestu=matricula.codestu and carrera.codcarre=matricula.codcarre;

RESULTADO:

4. A que alumnos les tocara ver clases con el profesor Portacio Cartagena.

ANALISIS

-Que deseo Mostrar:

  • Alumno.nombre
  • Profesor.nombre

-Tablas Involucradas

  • Alumno
  • Profesor
  • Matricula

-Condicion 

003 =  Código del profesor Portacio Cartagena
where matricula.codprofe=003

Relaciones

  • alumno.codestu=matricula.codestu
  • profesor.codprofe=matricula.codprofe
Código: select alumno.nombre as 'Alumno',profesor.nombre as 'Profesor' from alumno,profesor,matricula where matricula.codprofe=003 and alumno.codestu=matricula.codestu and profesor.codprofe=matricula.codprofe;

RESULTADO

5. cual es el valor del semestre más alto.

-Que deseo Mostrar

  • Matricula.valorsemestre

-Tablas Involucradas

  • Matricula

Función a utilizar:

Max= Me permite hallar el valor máximo

Códigoselect max(matricula.valorsemestre) as 'ValorSemestre' from matricula;

RESULTADO:

6. Cual es el promedio del valor de semestre que ha entrado a la cartera de la universidad.

-Que deseo Mostrar

  • Matricula.valorsemestre

-Tablas Involucradas

  • Matricula

Función a utilizar:

avg= Me permite hallar el promedio

Códigoselect avg(matricula.valorsemestre) as 'Promedio' from matricula;

RESULTADO:

7. Mostrar los nombres de los estudiantes que comiencen por A o que terminen en R.

-Que deseo Mostrar

  • Alumno.nombre

-Tablas Involucradas

  • Alumno

-Condicion

Alumnos que su nombre comienza por A y termina por R

 where nombre like 'A%R' 

Códigoselect alumno.nombre as 'Estudiante' from alumno where nombre like 'A%R';

RESULTADO: No hay alumnos que los nombre comiencen por A y terminen en R.


8. Total valorsemestre pagado por carrera

-Que deseo Mostrar

  • Carrera.carrera
  • Matricula.valorsemestre

-Tablas Involucradas

  • Carrera
  • Matricula

-Funcion

  • inner join
  • group by

Código:  select carrera.carrera, sum(matricula.valorsemestre) from carrera inner join matricula on carrera.codcarre=matricula.codcarre group by carrera;

RESULTADO

9. Visualizar los estudiantes que no están matriculados.

-Que deseo Mostrar

  • Alumno.nombre

-Tablas Involucradas

  • Alumno
  • Matricula

-Funcion

  • inner join

-Condicion

 where matricula.codestu is null 

Código: select alumno.nombre from alumno left join matricula on alumno.codestu=matricula.codestu where matricula.codestu is null;

Diagrama relacional:

Base de datos:

Josue Casalins Hernadez
Creado con Webnode
¡Crea tu página web gratis! Esta página web fue creada con Webnode. Crea tu propia web gratis hoy mismo! Comenzar